Skip to content

Commit 7002ec0

Browse files
committed
【添加】rgb_led 例程
1 parent 76620f7 commit 7002ec0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

examples/w601_iot_board/rgb_led.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
import utime as time
12+
from machine import Pin
13+
14+
PIN_LED_R = 38
15+
PIN_LED_G = 39
16+
PIN_LED_B = 40
17+
18+
LED_ON = 0
19+
LED_OFF = 1
20+
21+
led_r = Pin(("LED RED", PIN_LED_R), Pin.OUT_PP)
22+
led_g = Pin(("LED GREEN", PIN_LED_G), Pin.OUT_PP)
23+
led_b = Pin(("LED BLUE", PIN_LED_B), Pin.OUT_PP)
24+
25+
blink_tab = [(LED_ON,LED_ON,LED_ON),
26+
(LED_OFF,LED_ON,LED_ON),
27+
(LED_ON,LED_OFF,LED_ON),
28+
(LED_ON,LED_ON,LED_OFF),
29+
(LED_OFF,LED_OFF,LED_ON),
30+
(LED_ON,LED_OFF,LED_OFF),
31+
(LED_OFF,LED_ON,LED_OFF),
32+
(LED_ON,LED_OFF,LED_OFF)]
33+
34+
35+
while True:
36+
led.value(0) #Set led turn on
37+
time.sleep(0.5)
38+
led.value(1) #Set led turn off
39+
time.sleep(0.5)

0 commit comments

Comments
 (0)