Welcome to DOFBOT-JetsonNANO repository
1.Control RGB light
Control RGB Light
For convenient control, the underlying software of the robotic arm expansion board is developed separately and provides interface calls for controlling bus servos, PWM servos, and RGB lights. The relevant underlying driver source code has been packaged into a Python library, which is already installed in the factory image. If you want to port it to your own system, you can find the Dofbot.zip compressed package in the program source code summary folder.
Extract the compressed package: You need to copy the compressed package into Docker for extraction. Since basic control does not involve ROS, users can also install it on the host machine.
unzip Dofbot.zip
Install Python driver library: This is just a demonstration of how to install the Python driver library
xxxxxxxxxxcd Dofbot/0.py_install && sudo python3 setup.py install
After entering the user password and pressing Enter to confirm, if you see the installation prompt Arm_Lib=x.x.x version number, it means the installation was successful.
I. API Introduction
The corresponding API for RGB light is: Arm_RGB_set(R, G, B)
Function: Set the color of the RGB light.
Parameter explanation:
R: Control the brightness of the red color in the RGB light, range is 0-255, the larger the value, the brighter the light.
G: Control the brightness of the green color in the RGB light, range is 0-255, the larger the value, the brighter the light.
B: Control the brightness of the blue color in the RGB light, range is 0-255, the larger the value, the brighter the light.
Return value: None.
II. Start Docker
After entering the main board desktop, open a terminal and run the following command to start the corresponding Dofbot container:
xxxxxxxxxx./Docker_Ros.sh
Then enter the following command in the Docker terminal to start jupyter-lab,
xxxxxxxxxxcdjupyter-lab --allow-root
Then enter the main board's IP address followed by :9999 in the browser
xxxxxxxxxxIP:9999 // Example: 192.168.1.11:9999
III. Code Content
Code path: /root/Dofbot/3.ctrl_Arm/1.rgb.ipynb
xLoop to make the RGB light on the robotic arm expansion board light up red, green, and blue.#!/usr/bin/env python3#coding=utf-8import timefrom Arm_Lib import Arm_Device# Get the robotic arm objectArm = Arm_Device()time.sleep(.1)def main(): while True: Arm.Arm_RGB_set(50, 0, 0) #RGB lights up red time.sleep(.5) Arm.Arm_RGB_set(0, 50, 0) #RGB lights up green time.sleep(.5) Arm.Arm_RGB_set(0, 0, 50) #RGB lights up blue time.sleep(.5) print(" END OF LINE! ")try : main()except KeyboardInterrupt: # Release Arm object del Arm print(" Program closed! ") passOpen the 1.rgb.ipynb file from jupyter lab, and click the "run entire notebook" button on the jupyter lab toolbar, you will see the RGB light on the robotic arm expansion board cycle through red, green, and blue colors every 0.5 seconds.

To exit, click the stop button on the toolbar.
