Welcome to Pico Robot Car repository
3.5 Marquee light
3.5 Marquee
1. Learning Objectives
- Learn to combine the programmable RGB lights of the Raspberry Pi Pico 2/Pico mainboard and the car expansion board for experiments.
- Understand the use of programmable RGB lights to achieve the marquee effect.
2. Hardware Usage
This course uses the Pico 2/Pico mainboard and the car onboard programmable RGB lights

The car has 8 programmable RGB lights onboard, which can achieve colorful lighting effects. The 8 programmable lights have built-in ws2812 chips. Only one port is needed to control 8 lights at the same time through timing control. The timing control function is encapsulated in the library. We only need to call to set the color of the light.
3. Program Analysis
Code path: Code -> 1.Basic course -> 5. Horse race lamp.py
ximport timefrom pico_car import ws2812bnum_leds = 8 # Number of NeoPixels# Pin where NeoPixels are connectedpixels = ws2812b(num_leds, 0)# Set all ledpixels.fill(10,10,10)pixels.show()# horse race lampwhile True:for i in range(num_leds):for j in range(num_leds):#pixel_num, red, green, bluepixels.set_pixel(j,abs(i+j)%10,abs(i-(j+3))%10,abs(i-(j+6))%10)pixels.show()time.sleep(0.05)
from pico_car import ws2812b
Since we only want to turn on the lights, we only use the ws2812b from pico_car.
import time
The "time" library. This library handles everything to do with time, from measuring it to inserting delays into the program. The unit is seconds.
pixels = ws2812b(num_leds, 0)
Initialize the RGB lights. We have 8 RGB lights, so here num_leds is set to 8.
pixels.fill(10,10,10)
Set all lights to 10,10,10. The parameters are (red, green, blue), and the color brightness is 0-255.
pixels.show()
Display the set lights.
pixels.set_pixel(j,abs(i+j)%10,abs(i-(j+3))%10,abs(i-(j+6))%10)
This function is used to set the color of each light. The parameters are (light number, red, green, blue). The light number starts from 0 and the color brightness is 0-255. Here, two for loops are used to set the variable value to achieve the marquee effect.
4. Experimental Phenomenon
After the program is downloaded, we can see the marquee effect under the car.