Any chance of pre-compiling something for us? I am honesty more of a PERL guy, so simply having a binary that I can call would be quite useful. Something like "getgpio" and "setgpio."
Just a humble request. It has been a LONG time since I have done any C, but I am sure that I could dust off the cobwebs and make this myself, WHEN I finally get my own Pi.
OK. Here you go
At you request, I've written a command-line program that calls my Wiring Library. It's innefficient as it forks the command for every operation, but really, for what we're doing, who cares right now... It's fine. If we want to pulse LEDs on and off 100's of times a second then we'll care, but for now it's OK.
Actually, I now wish I'd written this program earlier as it's quite handy!
So, do this: (copy and paste)cd /tmp
sudo mv /tmp/gpio .
sudo chown root.root gpio
sudo chmod 4755 gpio
Then you should be able to run it as an ordinary user without usng sudo.
(But a word of warning here, I'm asking you to download and run a program as root that I've compiled - hopefully I'm trustworthy, but this is at your own risk!)
The commands are:gpio mode 0 out
gpio mode 8 in
gpio mode 1 pwm
gpio write 0 0
gpio write 0 1
gpio pwm 1 512
gpio read 8
gpio read 8
So gpio then
mode, followed by the pin number (0-16) then in, out or pwm.
write followed by the pin number then 0 or 1.
pwm followed by the pin number (ie. 1) then the value 0-1023
read followed by the pin number and it will print 0 or 1 depending on the pin state.
I'll post the source to it as part of the wiringPi package shortly.