Wall's Corners Wall's Corners Author
Title: Software for RaspBerry Pi
Author: Wall's Corners
Rating 5 of 5 Des:
We can write the program to control the simulator in a variety of languages. Using the  gpio program we can do it in a simple shell script (...

We can write the program to control the simulator in a variety of languages. Using the gpioprogram we can do it in a simple shell script (or even call it from languages such as php, perl, etc.) and using the wiringPi library then we can call it from C or C++.

As a bit of an exercise, I have written 2 versions – one using the standard BASH and the other in C. You can get the source code here:

The bash code (tuxx.sh) will run directly, but to make the C program run, we first need to compile it, then run it as root via the sudo command.

Setup:

mkdir ~/tuxx
cd ~/tuxx

To get and run the Bash version:

wget http://bit.ly/25WTGxH
chmod +x tuxx.sh
./tuxx.sh

To get and run the C version:

wget http://bit.ly/1U7PEYq
cc -o tuxx -Wall -I/usr/local/include -L/usr/local/lib tuxx.c -lwiringPi
sudo ./tuxx

to get the latest via GIT:

git clone git://git.drogon.net/gpioExamples
cd gpioExamples/tuxx
make
sudo ./tuxx

Do examine the code (both the C and Bash versions) to understand how they work and how to adapt them for your own projects

Enjoy!

-Gordon

Share This:

View more at: http://bit.ly/1XReQFr

About Author

Advertisement

Post a Comment

 
Top