We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 019ec58 commit 45113d1Copy full SHA for 45113d1
examples/w601_iot_board/key.py
@@ -0,0 +1,25 @@
1
+#
2
+# Copyright (c) 2006-2019, RT-Thread Development Team
3
4
+# SPDX-License-Identifier: MIT License
5
6
+# Change Logs:
7
+# Date Author Notes
8
+# 2019-06-13 SummerGift first version
9
10
+
11
+from machine import Pin
12
13
+PIN_LED_R = 38
14
+PIN_KEY0 = 57
15
+KEY_PRESSED = 0
16
17
+# create led object from pin PIN_LED_R, Set pin PIN_LED_R to output mode
18
+led = Pin(("led_red", PIN_LED_R), Pin.OUT_PP)
19
+key_0 = Pin(("key_0", PIN_KEY0), Pin.IN, Pin.PULL_UP)
20
21
+while True:
22
+ if key_0.value() == KEY_PRESSED:
23
+ led.value(0) # Set led turn on
24
+ else:
25
+ led.value(1)
0 commit comments