Wiki source code of Control Gateway GPIOs & LEDs

Version 10.1 by Edwin Chen on 2022/05/07 11:24

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
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}}
9
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 | |
14
15 = Control LEDs & GPIOs =
16
17 == OpenWrt Base OS ==
18
19 (% class="box infomessage" id="HControlanGeneralGPIO:" %)
20 (((
21 **Control a General GPIO:**
22
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
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
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]]