Compiling with wiringPi

Hello Eugene,

The original Micro SD broke down, so I got a new one and carried out a careful procedure, logging each step as I went. The result again is that Examples 1-2 and 3-4 run OK, while after double-clicking the executable of Example 5-2, noting at all happens. And the LED stays lighted during the entire process.

So, unless you find some flaw in my installation procedure (see below), I am at my wit’s end! - And I fear that my investment in hardware and in an Xojo licence will go down the drain.

As a remedy this situation, could I possibly suggest that I send you a blank Micro SD, and that you copy onto it an entire working system, and return it to me?

Knowing that I am testing your patience,

Strange

Installation procedure

New micro SD (8GB) formatted.
NOOBS files copied to SD.
SD inserted in Raspberry + power
Raspbian installed.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo rpi-update
Reboot needed
Reboot OK - - LED on all the time
sudo apt-get install git-core
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Release ‘core’ for ‘git’ not found
git clone git://git.drogon.net/wiringPi
Already up-to-date
cd wiringPi
git pull origin
./build
All Done
Note: To compile programs with wiringPi, you need to add:
-lwiringPi
to your compile line(s). To use the Gertboard, MaxDetect, etc. code (the devLib),
you need to also add:
-lwiringPiDev
to your compile line(s).
gpio -v
gpis version: 2.32
- - - -
Raspberry Pi Details:
Type: Pi 3, Revision: 02, Memory 1024MB, Make: Sony
* Device tree enabled.
* This Raspberry Pi supports user-level GPIO access.
-> See the man-page for more details
-> ie. export WIRINGPI_GPIOMEM=1
gpis 7 0
Unknown command: 7
dpkg --get-selections | grep wiringpi
wiringpi (in red) install
Reboot OK
Example2-1: OK
Example3-4: OK
Example5-2:
Move folder to Desktop
cd Desktop/Example5-2
chmod +x Example5-2
Double-Clicc folder on Desktop
Double-click on Executable
Nothing happens!
gpio 7 1: Unknown command: 7
dpkg --get-selections | grep wiringpi
wiringpi (in red) install
Plan B:
cd /home/pi/Downloads
tar xfz wiringPi-b0a60c3.tar.gz
cd wiringPi-b0a60c3
./build
gpio -v
As above, i.e., OK
Double-clicking the executable Example5-2: No effect!

Hello Strange,

First, I am glad that you are a very patient person - thank you. I have followed the helpful instructions you posted and I think (maybe?) that we might be talking about two different pins on the Raspberry Pi. Some of the instructions you have did not work on my Raspberry Pi 3 B. Here is what I did.

New MicroSD (32GB) formatted
NOOBS file copied to SD (version 1.92)
Raspbian installed
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo rpi-update
Reboot needed
LED NOT ON… Please wire LED to physical pin #7 (which is the same as BCM 4, which is Xojo 4)
sudo apt-get install git-core (git-core is already the newest version)
git clone git://git.drogon.net/wiringPi (not supported, going to plan B)
http://wiringpi.com/download-and-install
download snapshot (upper right corner)
cd home/pi/Downloads
tar xfz wiringPi-b0a60c3.tar.gz
cd wiringPi-b0a60c3
./build
All done
gpio -v (version 2.32 - yay, its working!)
gpio readall (this shows the pin layout)
Make sure the LED is connected to physical pin #7 (which is BCM 4)
gpio mode 7 out
gpio write 7 1 (LED should turn on)
gpio write 7 0 (LED should turn off)

Compile Example5-2
sudo ./Example5-2
LED turns on and off when pushing buttons

My guess is that we were talking about two different pins. Here is a link to the P1: main connector
P1: The main gpio connector

It shows that wiringPi Pin 7 is BCM/GPIO 4, with the name GPIO7, and header 7.

Here is the wiring diagram for this example:

I am hoping this will work, as it works on my Raspberry Pi. Thanks again :slight_smile:

Hello Eugene,

Hurrah! It works! And I have to thank you for your extreme patience.

And now when it works, I have one final question: I certainly want to make a backup of the Micro SD, - but when I enter your instruction for copying: “dd if=/dev/sdb of=30Dec2015PiImage.img bs=4M” in the Terminal of my iMac, I get this response: “dd: bs: illegal numeric value”, - so apparently something is wrong.

Most gratefully,

Strange

Hi Strange,

Congratulations getting the Raspberry Pi working.

Before you start, make sure that you have enough room on your hard drive. Here are longer instructions to backup the MicroSD card:

Go to search and type terminal
cd desktop
diskutil
// look for the name of your sd card which should be 8 GB. Mine is at location /dev/disk1
sudo dd if=/dev/disk1 of=~/Pi20July2016.dmg
//Wait for the command prompt. It doesn’t tell you that anything is happening until its finished. This could take a while

Backup and Restore Pi

I hope this helps :slight_smile:

Hi Eugene,

Thanks for the link. Now I’m all set!

And thanks again for all your help,

Strange

Your welcome, and have fun making exciting projects with Xojo and the Raspberry Pi!