diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-11-12 00:09:20 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-11-12 00:09:43 +0300 |
commit | 3c0da6a3592c715fa901e100a6d5ad256f19f67f (patch) | |
tree | d7ce57ed40977f85a38d049b6e8d2ada6cf451ec /examples/hwapi/button_led.py | |
parent | 1375c52772ad4f07d4bce40bfa114a0f2f0e6cfc (diff) | |
download | micropython-3c0da6a3592c715fa901e100a6d5ad256f19f67f.tar.gz micropython-3c0da6a3592c715fa901e100a6d5ad256f19f67f.zip |
examples/hwapi: button_led: Add GPIO pin read example.
Requires BUTTON defined in hwconfig, so far tested on DragonBoard 410c.
Diffstat (limited to 'examples/hwapi/button_led.py')
-rw-r--r-- | examples/hwapi/button_led.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/hwapi/button_led.py b/examples/hwapi/button_led.py new file mode 100644 index 0000000000..bd6fe01729 --- /dev/null +++ b/examples/hwapi/button_led.py @@ -0,0 +1,9 @@ +import utime +from hwconfig import LED, BUTTON + +# Light LED when (and while) a BUTTON is pressed + +while 1: + LED.value(BUTTON.value()) + # Don't burn CPU + utime.sleep_ms(10) |