Products LEDs Mapping
LPS8 | GPIO28(BLUE),GPIO21(RED),GPIO22(GREEN) | +3.3v] |
| |
Control LEDs & GPIOs
OpenWrt Base OS
Control a General GPIO:
echo 18 > /sys/class/gpio/export // Export gpio 18 so we can use it
echo "high" > /sys/class/gpio/gpio18/direction // Set direction to out and
set level to high. Use "low" to set direction to output and level to low
echo 0 > /sys/class/gpio/gpio18/value // Set output to 0 or 1
echo "in" > /sys/class/gpio/gpio18/direction // Set GPIO18 as input
cat /sys/class/gpio/gpio18/value // Get GPIO18 value if set input
Control a GPIO already exported as SYSTEM LEDs .
echo 1 > /sys/class/leds/dragino2\:red\:system/brightness // Turn On LED dragino2:red:system
echo 0 > /sys/class/leds/dragino2\:red\:system/brightness // Turn off LED dragino2:red:system
Reference: http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#gpio-sysfs