Welcome to RDK X5 Robot repository
10.Control fans and lighting effects
Control fans and lighting effects
10.1, Statement
RDK-X5-Robot factory image system will start OLED service by default. After OLED service is started, /home/sunrise/sunriseRobot/app_SunriseRobot/oled.py file will be run. The function of this file is to drive the OLED screen to display system information and turn on the fan and lighting effects. So please do not move or modify this file casually to avoid the startup service failing to find the file.
10.2, Control RGB cooling fan
x# Import smbus. If it is not installed, run pip3 install smbus to install it.# If it is not installed, run pip3 install smbusimport smbusimport timebus = smbus.SMBus(5)
Turn on the fan, start=[1-9], start=1 is the fastest, start=2~9, the larger the value, the faster the speed.
xxxxxxxxxxstart = 1bus.write_byte_data(0x0d, 0x08, start)time.sleep(.05)
Turn off the fan.
xxxxxxxxxxbus.write_byte_data(0x0d, 0x08, 0x00)time.sleep(.05)
Turn on the lighting effect, effect=[0-4], representing different lighting effects: 0 flowing light, 1 breathing light, 2 marquee, 3 rainbow light, 4 colorful light.
xxxxxxxxxxeffect = 2bus.write_byte_data(0x0d, 0x04, effect)time.sleep(.05)
Turn off the light.
xxxxxxxxxxbus.write_byte_data(0x0d, 0x07, 0x00)time.sleep(.05)