Welcome to Rider Pi Robot repository
6. RGB light control
RGB light control
1. Experimental purpose
To realize the RGB light control of the car. When controlling the RGB light of the car, the car must maintain a standing balance, otherwise the desired control effect cannot be achieved
2. Experimental path source code
Enter the system of the car, end the car program, enter "ip (ip is the ip of the car): 8888" in the browser, enter the password "yahboom"
Then log in
Enter the path of Rider-pi_class/2.Basic Control Ooperations/6.RGB lamp control and run RGB Control.ipynb.
3. Experimental phenomenon
After running the code, you can see the corresponding phenomenon Drag the corresponding color bar to make the RGB light show different colors.
4. Main source code analysis
def set_rgb(R, G, B):g_car.rider_led(1, [R,G,B])g_car.rider_led(2, [R,G,B])g_car.rider_led(3, [R,G,B])g_car.rider_led(4, [R,G,B])The 1, 2, 3, and 4 in this function represent the colors of different lights. The three parameters R, G, and B represent different colors 0-255, 0: minimum color value 255: maximum color value.