Wiki source code of Control Gateway GPIOs & LEDs
Version 13.1 by Edwin Chen on 2022/05/07 11:28
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{box cssClass="floatinginfobox" title="**Contents**"}} |
2 | {{toc/}} | ||
3 | {{/box}} | ||
4 | |||
![]() |
12.1 | 5 | = Products LEDs Mapping = |
![]() |
11.1 | 6 | |
7 | {{velocity}} | ||
![]() |
10.1 | 8 | $xwiki.ssfx.use("js/xwiki/table/table.css") |
9 | $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true) | ||
10 | {{/velocity}} | ||
![]() |
1.1 | 11 | |
![]() |
10.1 | 12 | (% class="doOddEven filterable grid sortable" id="tableid" %) |
![]() |
12.1 | 13 | (% class="sortHeader" %)|=Model|=Global LED|=PWR LED |
![]() |
13.1 | 14 | |LPS8|GPIO28(BLUE),GPIO21(RED),GPIO22(GREEN)|+3.3v |
![]() |
10.1 | 15 | | | |
![]() |
1.1 | 16 | |
![]() |
1.2 | 17 | = Control LEDs & GPIOs = |
![]() |
1.1 | 18 | |
![]() |
1.2 | 19 | == OpenWrt Base OS == |
![]() |
1.1 | 20 | |
![]() |
6.1 | 21 | (% class="box infomessage" id="HControlanGeneralGPIO:" %) |
22 | ((( | ||
![]() |
8.1 | 23 | **Control a General GPIO:** |
![]() |
1.1 | 24 | |
![]() |
1.2 | 25 | **echo 18 > /sys/class/gpio/export** ~/~/ Export gpio 18 so we can use it |
26 | **echo "high" > /sys/class/gpio/gpio18/direction** ~/~/ Set direction to out and | ||
27 | set level to high. Use "low" to set direction to output and level to low | ||
28 | |||
29 | **echo 0 > /sys/class/gpio/gpio18/value** ~/~/ Set output to 0 or 1 | ||
30 | **echo "in" > /sys/class/gpio/gpio18/direction** ~/~/ Set GPIO18 as input | ||
31 | |||
32 | **cat /sys/class/gpio/gpio18/value** ~/~/ Get GPIO18 value if set input | ||
33 | ))) | ||
34 | |||
![]() |
9.1 | 35 | (% class="box infomessage" %) |
36 | ((( | ||
37 | **Control a GPIO already exported as SYSTEM LEDs .** | ||
38 | **echo 1 > /sys/class/leds/dragino2\:red\:system/brightness** ~/~/ Turn On LED dragino2:red:system | ||
39 | **echo 0 > /sys/class/leds/dragino2\:red\:system/brightness** ~/~/ Turn off LED dragino2:red:system | ||
40 | ))) | ||
41 | |||
42 | |||
![]() |
3.1 | 43 | 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]] |