NRU Series
25
23
unconnected
24
25
DIO Script Sample
In the following sample bash script, you can see how to access the DIO in Linux.
# DIO GPIO Pin
DO0=320
DO1=321
DO2=322
DO3=323
DI1=325
DI2=331
DI3=326
function exposeDI() {
## Expose DI to User Space
echo $1 >/sys/class/gpio/export 2>/dev/null
echo in >/sys/class/gpio/gpio$1/direction
}
function exposeDO() {
echo $1 >/sys/class/gpio/export 2>/dev/null
echo out >/sys/class/gpio/gpio$1/direction
}
function setDO() {
echo $2 >/sys/class/gpio/gpio$1/value
}
function getDO() {
cat /sys/class/gpio/gpio$1/value
}
### Initial DI
exposeDI $DI1
exposeDI $DI2