Welcome to DOFBOT-Ultra repository
1. Control RGB Light
Control RGB Light
1. API Introduction
The API for the RGB light is: Arm_RGB_set(R, G, B)
Function: Sets the color of the RGB light.
Parameter Description:
R: Controls the red brightness of the RGB light, range 0-255, the larger the value, the brighter.
G: Controls the green brightness of the RGB light, range 0-255, the larger the value, the brighter.
B: Controls the blue brightness of the RGB light, range 0-255, the larger the value, the brighter.
Return value: None.
2. Code
Taking the Raspberry Pi version as an example, open JupyterLab from the browser. Code path:
~/dofbot_ctrl/scripts/01.rgb.ipynb
x#!/usr/bin/env python3#coding=utf-8import timefrom Arm_Lib import Arm_Device# 获取机械臂的对象 Get the robot arm objectArm = Arm_Device()time.sleep(.1)def main(): while True: Arm.Arm_RGB_set(50, 0, 0) # RGB亮红灯 RGB lights up red time.sleep(.5) Arm.Arm_RGB_set(0, 50, 0) # RGB亮绿灯 RGB green light time.sleep(.5) Arm.Arm_RGB_set(0, 0, 50) # RGB亮蓝灯 RGB blue light time.sleep(.5) print(" END OF LINE! ")try : main()except KeyboardInterrupt: # 释放Arm对象 Release the Arm object del Arm print(" Program closed! ") passOpen the code file from Jupyter Lab and click the "Run All Cells" button on the Jupyter Lab toolbar. You will see the RGB light on the robotic arm expansion board cycle through red, green, and blue every 0.5 seconds.

To exit, click the stop button on the toolbar.
