Last modified by Xiaoling on 2023/06/01 17:01

From version 5.1
edited by Edwin Chen
on 2022/05/03 08:00
Change comment: There is no comment for this version
To version 9.1
edited by Edwin Chen
on 2022/05/03 08:59
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -22,10 +22,10 @@
22 22  
23 23  == OpenWrt Base OS ==
24 24  
25 -=== Control an General GPIO: ===
26 -
27 -(% class="box infomessage" %)
25 +(% class="box infomessage" id="HControlanGeneralGPIO:" %)
28 28  (((
27 +**Control a General GPIO:**
28 +
29 29  **echo 18 > /sys/class/gpio/export**     ~/~/ Export gpio 18 so we can use it
30 30  **echo "high" > /sys/class/gpio/gpio18/direction**   ~/~/  Set direction to out and
31 31  set level to high. Use "low" to set direction to output and level to low
... ... @@ -36,4 +36,12 @@
36 36  **cat  /sys/class/gpio/gpio18/value**  ~/~/ Get GPIO18 value if set input
37 37  )))
38 38  
39 +(% class="box infomessage" %)
40 +(((
41 +**Control a GPIO already exported as SYSTEM LEDs .**
42 +**echo 1 > /sys/class/leds/dragino2\:red\:system/brightness**  ~/~/ Turn On LED dragino2:red:system
43 +**echo 0 > /sys/class/leds/dragino2\:red\:system/brightness**  ~/~/ Turn off LED dragino2:red:system
44 +)))
45 +
46 +
39 39  Reference: [[http:~~/~~/www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#gpio-sysfs>>url:http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#gpio-sysfs]]