1.Introduction to RGB programming light bar driver
In the previous 【5.1 Using of GPIO】, we introduced the RGB strip driver and the PCA9685 driver using the same I2C2 bus, so the underlying driver code for I2C communication is also consistent with the PCA9685, but the address of the communication is different.
Let me introduce the use of RGB programming light strips on the underlying code that is consistent with the PCA9685 driver I2C communication:
The RGB programming light bar is a custom-made module specially designed for Jetbot by Yahboom. It is also very convenient to use the customized RGB_Lib.py.
You can simply implement the cool lighting demonstrations by simply calling the corresponding instance methods in our library.
Path of package : [Jetbot-AI Car] --> [Annex] --> [Driver file]---> [RGB_Lib.py]
As shown in the above figure, it is the RGB gameplay included in our Jetbot robot car APP.
The I2C slave address of the RGB stripe peripheral is 0x1B.
When we first create an RGB instance, we automatically call the initialization function in Programming_RGB() to get the I2C peripheral, and then we can call the method inside the instance:
*Set color of all RGB light
Set_All_RGB(self, R_Value, G_Value, B_Value)
*Close all RGB light
OFF_ALL_RGB(self)
*Set the RGB light color at a certain location
Set_An_RGB(self, Position, R_Value, G_Value, B_Value)
*Set water light effects
Set_WaterfallLight_RGB(self)
*Set color breathing light effects
Set_BreathColor_RGB(self)
*Set chameleon light effects
Set_ChameleonLight_RGB(self)
As shown below:
The first function is to control the range of RGB lights.
The second function is to control the breathing rate of a monochrome breathing light.
The third function is to start displaying the monochrome breathing light effect set in front.
Set_BreathSColor_RGB(self, color) #Color value range:0-6
Set_BreathSSpeed_RGB(self, speed) #Speed value range:1,2,3
Set_BreathSLight_RGB(self)
2. Use RGB driver to light any 16 million color RGB lights
First import the RGB driver library and create an instance of controlling the RGB programming light bar:
Then, follow the code as shown in the figure to achieve the corresponding display effect:
The corresponding complete source code is located:
/home/jetbot/Notebook/5.Using of RGB strip/1.Light up a RGB light at any position/Light up a RGB light at any position.ipynb
3.RGB special effects
First, import the RGB driver library and create an instance of controlling the RGB programming light bar:
The first step is to import the RGB driver library, create an instance of controlling the RGB programming light bar, and then realize the corresponding lighting effects according to the following code:
The corresponding complete source code is located:
/home/jetbot/Notebook/5.Using of RGB strip/2.RGB special effects/RGB special effects.ipynb
Tutorial
- Yahboom JetBot AI Robot Car Tutorial
- Last Tutorial>> 4.3 Using of PCA9685 driver
- Next Tutorial>> 4.5 Using of Onboard OLED
Buy Yahboom Jetbot AI robot with HD Camera Coding with Python for Jetson Nano