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