Difference between revisions of "Install RPi relay board"
From xPL
(→WiringPi) |
(→WiringPi) |
||
Line 22: | Line 22: | ||
Check the installation: | Check the installation: | ||
gpio -v | gpio -v | ||
+ | |||
+ | Test the relays: | ||
+ | PIN=25 | ||
+ | gpio mode $PIN output ; gpio write $PIN 0 ; sleep 1 ; gpio write $PIN 1 | ||
+ | |||
+ | for PIN in 25 28 29; do | ||
+ | echo driving pin $PIN | ||
+ | gpio mode $PIN output | ||
+ | gpio write $PIN 0 | ||
+ | sleep 1 | ||
+ | gpio write $PIN 1 | ||
+ | sleep 1 | ||
+ | done | ||
[[Category: all]] [[Category: install]] [[Category: xPL]] | [[Category: all]] [[Category: install]] [[Category: xPL]] |
Revision as of 17:18, 30 March 2017
The Waveshare RPi Relay Board houses 3 relays controlled by Raspberry Pi General-Purpose Input/Outputs (GPIOs).
They can be controlled by:
- shell commands built from the WiringPi libraries
- C-programs compiled with the C library for Raspberry Pi
- python scripts
WiringPi
Ckeck the download link.
Install the library:
su cd /tmp/ wget http://www.waveshare.com/w/upload/f/f3/WiringPi.tar.gz tar -xvzf WiringPi.tar.gz cd wiringPi/ chmod 777 build ./build
Check the installation:
gpio -v
Test the relays:
PIN=25 gpio mode $PIN output ; gpio write $PIN 0 ; sleep 1 ; gpio write $PIN 1 for PIN in 25 28 29; do echo driving pin $PIN gpio mode $PIN output gpio write $PIN 0 sleep 1 gpio write $PIN 1 sleep 1 done