User Tools

Site Tools


Sidebar

Launch of Linino.org

wiki:digitalio_shield

DIGITALIO SHIELD

The digital IO shield allows you to add 16 more gpios to the already existing ones of your Linino board. The shield is equipped with 8 Leds, 4 Relays and 4 push buttons as follows:

DIGITAL-IO SHIELD
GPIO OUTPUT shield NODEJS
216 gpio216 push button 1SD0
217 gpio217 push button 2SD1
218 gpio218 push button 3SD2
219 gpio219 push button 4SD3
220 gpio220 SD4
221 gpio221 SD5
222 gpio222 SD6
223 gpio223 SD7
224 gpio224 Led 1 / Relay 1SD8
225 gpio225 Led 2 / Relay 2SD9
226 gpio226 Led 3 / Relay 3SD10
227 gpio227 Led 4 / Relay 4SD11
228 gpio228 Led 5SD12
229 gpio229 Led 6SD13
230 gpio230 Led 7SD14
231 gpio231 Led 8SD15

To enable the digitalIO shield you can run this command:

root@linino:~# echo digitalio > /sys/devices/mcuio/shield_register

If the shield registration is successful, you will be able to detect gpiochip216 in the following sysfs path :

root@linino:~# ls /sys/class/gpio/
export       gpio22       gpiochip0         gpiochip216
gpio21       gpio23       gpiochip100    unexport

PUSH BUTTON

SHELL

to enable the use of a given push button, you first have to export its correspondig gpio (i.e. push button 1 on the gpio 216):

root@linino:~# echo 216 > /sys/class/gpio/export

set the gpio direction in input mode:

root@linino:~# echo in > /sys/class/gpio/gpio216/direction

and then you can read the input value:

root@linino:~# cat /sys/class/gpio/gpio216/value
0

NODEJS

To read the push button state in nodejs, run the following script:

 

LED

SHELL

to enable the use of a given led, you first have to export its correspondig gpio (i.e. Led 5 on the gpio 228):

root@linino:~# echo 228 > /sys/class/gpio/export

set the gpio direction in output mode:

root@linino:~# echo out > /sys/class/gpio/gpio228/direction

and then turn the led on by running this command:

root@linino:~# echo 1 > /sys/class/gpio/gpio228/value

NODEJS

RELAY

SHELL

to enable the use of a given relay, you first have to export its correspondig gpio (i.e. Relay 1 on the gpio 224):

root@linino:~# echo 224 > /sys/class/gpio/export

set the gpio direction in output mode:

root@linino:~# echo out > /sys/class/gpio/gpio224/direction

then, you can change relay's state by writing “1” or “0” in the “value” field:

root@linino:~# echo 1 > /sys/class/gpio/gpio224/value

NODEJS

/var/www/wiki.linino.org/data/pages/wiki/digitalio_shield.txt · Last modified: 2015/06/30 09:38 by administrator

2014 © dog hunter llc and the Linino Community. Linino.org is a dog hunter sponsored community project. Credits