RGB cooling HAT needs to be correctly inserted into the GPIO port of the RDK-X3, and the I2C function of the RDK-X3 needs to be turned on.
The phenomenon of this experiment is that all RGB lights light up purple and have a breathing light effect.
1.Install WinSCP on your computer, connect to RDK X3, and transfer the temp_control_C.zip package downloaded from the documentation to the pi directory of the RDK X3.
2.Extract file
Open the terminal in RDK X3 system and find temp_control_C.zip file.
Enter the following command to extract the file.
unzip temp_control_C.zip
1.Enter the folder and view the files in the current folder
xxxxxxxxxx
cd temp_control_C/i2c_RGB
ls
2.Compile program files
xxxxxxxxxx
gcc -o RGB I2C_RGB.c myi2c.c
Among them, the gcc compiler is called, -o means to generate files, followed by the generated file name, I2C_RGB.c is the source program, and myi2c.c is used to drive the devices on the I2C bus of the X3 pie.
xxxxxxxxxx
sudo ./RGB
At this time, we can see the three RGB lights light up with purple breathing light effect at the same time.
1.There are three RGB lights on the smart personal butler board, so define the number of lights as 3, define the register addresses: RGB_Effect as 0x04, RGB_Speed as 0x05, RGB_Color as 0x06.
Declare the functions that need to be used.
2.void setRGB(int num, int R, int G, int B) function.
Set the color of the RGB light. num refers to which light. 0 is the first light, 1 is the second light, and 2 is the third light. If it is greater than or equal to 3, all lights are set at the same time. The value range of R, G, and B is 0~255.
3.Turn off RGB. According to the protocol, the register for turning off RGB is 0x07 and the data is 0x00.
4.void setRGBEffect(int effect) function
First, determine the input value and correspond to the protocol. There are a total of five special effects to choose from: 0 flowing light, 1 breathing light, 2 marquee, 3 rainbow light, and 4 colorful light.
5.void setRGBSpeed(int speed) function
Modify the RGB light switching speed of the above modes. 1 low speed, 2 medium speed (default), 3 high speed, if not set, the default is medium speed.
6.void setRGBColor(int color) function
Set the color of the flowing light and breathing light in the RGB light effect, 0 is red, 1 is green (default), 2 is blue, 3 is yellow, 4 is purple, 5 is cyan, 6 is white. If not set, the default is green.
7.Initialize I2C configuration
8.Setting a high-speed purple breathing light.