Welcome to ROS Robot Expansion Board repository
6. RGB colorful light bar special effects
6. RGB colorful light bar special effects
6. RGB colorful light bar special effects 6.1. Experimental objectives6.2. Experiment preparation6.3. Experimental effect6.4. Program source code
6.1. Experimental objectives
Control the RGB colorful light bar to display different special effects, manually control the color of the RGB light bar, and set the color of a single RGB light.
6.2. Experiment preparation
The position of the red box in the picture below is the interface of the RGB colorful light bar. The interface has anti-reverse connection function, and there is no need to worry about reverse connection during the connection process.
RGB dazzling lights support the color of a single light, as well as control the color of all lights.

The Rosmaster_Lib library functions required to control the RGB colorful light bar effects are as follows:
set_colorful_effect(effect, speed=255, parm=255)Parameter explanation: RGB programmable light strip special effects display.
effect=[0, 6], 0: stop light effect, 1: running water light, 2: marquee light, 3: breathing light, 4: gradient light, 5: starlight, 6: battery display
speed=[1, 10], the smaller the value, the faster the speed changes.
parm, optional, as an additional parameter. Usage 1: Enter [0, 6] for the breathing light effect to modify the color of the breathing light.
Return value: None.
xxxxxxxxxxset_colorful_lamps(led_id, red, green, blue)Parameter explanation: RGB programmable light strip control, which can be controlled individually or as a whole. Before the control, you need to stop the RGB light effects.
led_id=[0, 16], control the corresponding number of RGB lights; led_id=0xFF, control all lights.
red,green,blue=[0, 255], indicating the color RGB value.
Return value: None.
6.3. Experimental effect
Check out the course accompanying video.
6.4. Program source code
Check 【Sample code】---> check file: Before running above code on RDK X3, ReadMe. Complete the operation process.
Code path:Rosmaster/Samples/6.rgb_effect.ipynb