Ms14 gpios

From Wiki for Dragino Project
Jump to: navigation, search

Use GPIOs

Export gpio 18 so we can use it

echo 18 > /sys/class/gpio/export    


Set direction to out and set level to high. Use "low" to set direction to output and level to low

echo "high" > /sys/class/gpio/gpio18/direction    


Set output to 0 or 1

echo 0 > /sys/class/gpio/gpio18/value     


Set GPIO18 as input

echo "in" > /sys/class/gpio/gpio18/direction 


Get GPIO18 value if set input

cat  /sys/class/gpio/gpio18/value

Reference

http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#gpio-sysfs