Controlling the LEDs
In this section, we will get started with testing the RGB LEDs on the Kitronik Robotics kit. There are four RGB LEDs on the chassis (highlighted in Figure 9.6). The LEDs could be used to provide a visual indication of the robot's action. We will light them up in a circular pattern.
The code sample discussed in this section is rgb_led_test.py
:
- In the Thonny IDE, create a file called
main.py
and save it to your Pico, as shown in the following figure, where the dialog appears when you click on the Save button.
- Now, let's discuss the code meant to drive the LEDs in a circular pattern. The first step is to import the requisite modules. We are going to need the
KitronikPicoRobotBuggy
class from the library we installed earlier, along with thetime
module:from PicoAutonomousRobotics...