File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import utime
2+ from hwconfig import LED , BUTTON
3+
4+ # Light LED when (and while) a BUTTON is pressed
5+
6+ while 1 :
7+ LED .value (BUTTON .value ())
8+ # Don't burn CPU
9+ utime .sleep_ms (10 )
Original file line number Diff line number Diff line change 11from machine import Pin
22
33# 96Boards/Qualcomm DragonBoard 410c
4+ #
45# By default, on-board LEDs are controlled by kernel LED driver.
56# To make corresponding pins be available as normal GPIO,
67# corresponding driver needs to be unbound first (as root):
78# echo -n "soc:leds" >/sys/class/leds/apq8016-sbc:green:user1/device/driver/unbind
89# Note that application also either should be run as root, or
910# /sys/class/gpio ownership needs to be changed.
11+ # Likewise, onboard buttons are controlled by gpio_keys driver.
12+ # To release corresponding GPIOs:
13+ # echo -n "gpio_keys" >/sys/class/input/input1/device/driver/unbind
1014
1115# User LED 1 on gpio21
1216LED = Pin (21 , Pin .OUT )
17+
18+ # Button S3 on gpio107
19+ BUTTON = Pin (107 , Pin .IN )
You can’t perform that action at this time.
0 commit comments