EasyManua.ls Logo

Seeed Grove - Page 22

Seeed Grove
29 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
7/23/22, 9:41 PM
Grove - Chainable RGB LED - Seeed Wiki
https://wiki.seeedstudio.com/Grove-Chainable_RGB_LED/
22/29
62
63 # Now must send the 3 colors
64 self.sendByte(blue)
65 self.sendByte(green)
66 self.sendByte(red)
67
68 def setColorRGB(self, led, red, green, blue):
69 # Send data frame prefix (32x '0')
70 self.sendByte(0x00)
71 self.sendByte(0x00)
72 self.sendByte(0x00)
73 self.sendByte(0x00)
74
75 # Send color data for each one of the leds
76 for i in range(self.__number_of_leds):
77 '''
78 if i == led:
79 _led_state[i*3 + _CL_RED] = red;
80 _led_state[i*3 + _CL_GREEN] = green;
81 _led_state[i*3 + _CL_BLUE] = blue;
82 sendColor(_led_state[i*3 + _CL_RED],
83 _led_state[i*3 + _CL_GREEN],
84 _led_state[i*3 + _CL_BLUE]);
85 '''
86 self.sendColor(red, green, blue)
87
88 # Terminate data frame (32x "0")
89 self.sendByte(0x00)
90 self.sendByte(0x00)
91 self.sendByte(0x00)
92 self.sendByte(0x00)
93
94
95 # Note: Use P9_22(UART2_RXD) and P9_21(UART2_TXD) as GPI
96 # Connect the Grove - Chainable RGB LED to UART Grove po
97 if __name__ == "__main__":
98 rgb_led = ChainableLED(CLK_PIN, DATA_PIN, NUMBER_OF_
99
100 while True:
101 # The first parameter: NUMBER_OF_LEDS - 1; Other
102 rgb_led.setColorRGB(0, 255, 0, 0)

Other manuals for Seeed Grove

Related product manuals