Wiki source code of Control Gateway GPIOs & LEDs

Version 11.1 by Edwin Chen on 2022/05/07 11:26

Hide last authors
Edwin Chen 1.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
Edwin Chen 11.1 5 = Products LEDs Mapping=
6
7 {{velocity}}
Edwin Chen 10.1 8 $xwiki.ssfx.use("js/xwiki/table/table.css")
9 $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
10 {{/velocity}}
Edwin Chen 1.1 11
Edwin Chen 10.1 12 (% class="doOddEven filterable grid sortable" id="tableid" %)
13 (% class="sortHeader" %)|=Model|=Photo
14 |[[**LHT65N**>>LHT65N LoRaWAN Temperature & Humidity Sensor Manual]]|[[image:LHT65N_00.jpg||height="114" width="114"]]
15 | |
Edwin Chen 1.1 16
Edwin Chen 1.2 17 = Control LEDs & GPIOs =
Edwin Chen 1.1 18
Edwin Chen 1.2 19 == OpenWrt Base OS ==
Edwin Chen 1.1 20
Edwin Chen 6.1 21 (% class="box infomessage" id="HControlanGeneralGPIO:" %)
22 (((
Edwin Chen 8.1 23 **Control a General GPIO:**
Edwin Chen 1.1 24
Edwin Chen 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
Edwin Chen 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
Edwin Chen 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]]