ADEEPT AWR Wheeled Robot Manual page 72

4wd smart robot kit compatible with raspberry pi 4 3 model b+ b, opencv target tracking
Table of Contents

Advertisement

63
●Instantiate the object and execute the method function. The function colorWipe () needs to pass in three
parameters, namely R, G, and B, which correspond to the brightness of the three primary colors of red, green,
and blue. The value range is 0- 255, the larger the value, the higher the brightness of the corresponding color
channel. If the values of the three color channels are the same, white light is emitted. Specific examples are as
follows:
if
__name__ == '__main__':
LED = LED()
try:
while
1:
LED.colorWipe(255, 0,
time.sleep(1)
LED.colorWipe(0, 255,
time.sleep(1)
LED.colorWipe(0, 0,
time.sleep(1)
except:
LED.colorWipe(Color(0,0,0))
●The above code will control all WS2812 lights to cycle through the three colors, press CTRL+C to exit
the program.
● If you want to control the color of a single lamp, you can use the following code, where i is the serial
number of the lamp, the serial number of the first lamp connected from the driver board is 0, and the second
lamp is 1. By analogy, R, G, B are the brightness of the corresponding three color channels:
LED.strip.setPixelColor(i, Color(R, G, B))
LED.strip.show()
●Note: You must use the Color () method to pack the RGB values and then pass them to setPixelColor ()
0)
# All the lights turn red
0)
# All lights turn green
255)
# All lights turn blue
# Turn off all lights

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AWR Adeept Wheeled Robot and is the answer not in the manual?

This manual is also suitable for:

Picar-b

Table of Contents

Save PDF