7/23/22, 9:41 PM
Grove - Chainable RGB LED - Seeed Wiki
https://wiki.seeedstudio.com/Grove-Chainable_RGB_LED/
10/29
27
testColorGreen
=
2
#
0
b
010
#
00
FF
00
28
testColorCyan
=
3
#
0
b
011
#
00
FFFF
29
testColorRed
=
4
#
0
b
100
#FF
0000
30
testColorMagenta
=
5
#
0
b
101
#FF
00
FF
31
testColorYellow
=
6
#
0
b
110
#FFFF
00
32
testColorWhite
=
7
#
0
b
111
#FFFFFF
33
34
# patterns used in grovepi.chainableRgbLed_patte
35
thisLedOnly
=
0
36
allLedsExceptThis
=
1
37
thisLedAndInwards
=
2
38
thisLedAndOutwards
=
3
39
40
try
:
41
42
"Test 1) Initialise"
43
44
# init chain of leds
45
grovepi
.chainableRgbLed_init(pin, numleds)
46
time
.sleep(.
5
)
47
48
# change color to green
49
grovepi
.storeColor(
0
,
255
,
0
)
50
time
.sleep(.
5
)
51
52
# set led 1 to green
53
grovepi
.chainableRgbLed_pattern(pin, thisLed
54
time
.sleep(.
5
)
55
56
# change color to red
57
grovepi
.storeColor(
255
,
0
,
0
)
58
time
.sleep(.
5
)
59
60
# set led 10 to red
61
grovepi
.chainableRgbLed_pattern(pin, thisLed
62
time
.sleep(.
5
)
63
64
# pause so you can see what happened
65
time
.sleep(
2
)
66
67
# reset (all off)