As said before, Wiring Pi is a library. It simplifies a lot using the Raspberry Pi GPIOs (one command instead a long process). It also means that you can use it in any of your C codes. However, we won't build and use a C program but the Gpio utility. It's a software made by Gordon and coming with the library. It allows you to control the GPIOs in a bash script or directly in a command line. Using this utility is however a lot slower than a C program.

We first need to install it. Gordon himself is explaining it very well on his website: http:///download-and-install/ . You just need to download it from GIT then to build it using the ./build command.
You should now be able to use the Gpio utility, type the " gpio mode 0 out " command to test it out. If nothing special appears, everything's fine. Else, if the board is printing "command not found error" or something like that, be sure that you've followed the guide and build the library.

Let's turn on and off the first LED (Wiring pin 0). You first need to set the pin as an output. Use the " gpio mode 0 out " command to do so. "0" is the wiring pin number and "out" simply stands for output. Now, use the " gpio write 0 1 " command to turn on your LED. "0" is again the pin number and "1" is the status (1 for ON and 0 for OFF). If everything's fine you should see your LED shining. To turn it off, simply use the " gpio write 0 0 " command.
Just a little tip, if you want to use the actual pin number (GPIO-17) instead of the Wiring Pi number (0 is corresponding to GPIO-17), use the -g flag in your command. Ex: " gpio -g write 17 1 " instead of " gpio write 0 1 ".

There is also the " gpio read " command which allows you to read the pin's status. It may seems useless when the pin has been set as an output but it allows you to be sure of the pin's status when you can't see the LED. Using it is as simple as before, just type " gpio read 0 " where "0" is the wiring pin number. The command is returning the pin's status (again 1 for ON and 0 for OFF).

Finally the Wiring Pi library is containing a lot of other commands/functions but I'm not gonna cover them in this instructable since there are not useful here. See this page if you are more curious: http:///reference/ (library's functions) and https:///raspberry-pi/wiringpi/the-gpio-utility/ or the " man gpio " command for the Gpio utility.

Now that you can use this utility, let's play a little bit with it. You can first, if it's not already the case, control remotely your Raspberry Pi with SSH. You can use Putty for Windows or ServerAuditor for your Smartphone. Then have fun with bash scripts such as this one which is turning on LEDs 0 to 7, waiting 2 seconds, then turning them off again:

“The animal we study is not stupid,” the researchers from Penn State and Temple University might have told me, should I have asked them. “It is a good animal that lives for a long time,” they would have said. “No, it is dumb and I don’t like it,” I would have replied. This conversation didn’t happen.

The passion of special interest groups on each side of the issue and the whipsaw politics of inter-governmental advice is demoralizing to the biologists tasked with making hard decisions. Such is the friction-filled human-wildlife interface around the world, from Australia saltwater crocodiles to Manitoba polar bears; Zimbabwe’s crop-raiding elephants to Vancouver Island cougars. 


Interface - The HardestInterface - The HardestInterface - The HardestInterface - The Hardest

qohev.myallergy.us