GPIO - raspberry PI

Jan 06, 2015 3 Replies

Hi to all. Am looking for some ultra simple, ready made script for this task:


- start the script on boot



- set high on some 3V GPIO



- wait for 2 seconds



- set low and exit the program



This is used for simulating button press and for no other purposse. I have made one relay board which should trigger relay with 3v / 2mA. When this happens relay contacts would simulate button press.



G.


Have you considered getting on the actual rPi forums?

I am sure that your response there would be quicker and more definitive.

On a sunny day (Tue, 06 Jan 2015 11:19:43 +0100) it happened gm wrote in :

You can add your script in the file /etc/rc.local so it starts after boot.

/etc/rc.local ... /usr/bin/my_script ...

in /usr/bin/my_script add your commends. There exists a GPIO library to set and read GPIO pins, so it can be a simple bash-script (I forgot how that library is called, I do it al in C), OK, here:

formatting link

In /usr/bin/my_script

#set GPIO someting gpio write X 1 # wait 2 seconds sleep 2 #reset GPIO someting gpio write X 0

# X is the GPIO pin number (check your GPIO version, A, B, B+ for what pins can be used . Make script executable with: chmod +x /usr/bin/my_script

Or something like that.

------------- OK. thank you, i will try. What do you think about this lib :

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required