Welcome to ROSMASTER X3 repository
6. RGB colorful light bar special effects display
6. RGB colorful light bar special effects display
6. RGB colorful light bar special effects display 6.1. Experimental objectives 6.2. Experiment preparation 6.3. Experimental effect 6.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
Refer to 4.3.1 and 4.3.2 Checking ROS expansion board and entering Docker container, then run the program. double-click on the jupyter lab interface to enter /root/yahboomcar_ros2_ws/Rosmaster/Sample.
Double-click and select 6.rgb_effect.ipynb, and click the button in 4.3.3 to operate the program step by step.
6.4. Program source code
Go to docker, Reference code path: /root/yahboomcar_ros2_ws/Rosmaster/Sample/6.rgb_effect.ipynb