Welcome to DOFBOT-Ultra repository
6. DOFBOT Up Down Left Right Movement
DOFBOT Up Down Left Right Movement
1. Experiment Overview
This experiment controls the robotic arm to move up, down, left, and right, then return to the upright position. By simultaneously controlling different angles of servo 3 and servo 4, the arm achieves up and down movement. Then, controlling servo 1 achieves left and right movement, and finally, it returns to the upright position.
2. Code
Code path:
~/dofbot_ctrl/scripts/06.left_right.ipynb
x
#!/usr/bin/env python3#coding=utf-8import timefrom Arm_Lib import Arm_Device# Create robotic arm objectArm = Arm_Device()time.sleep(.1)x
def main(): # Let the servos return to center position Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 500) time.sleep(1) while True: # Control servos 3 and 4 for up and down movement Arm.Arm_serial_servo_write(3, 0, 1000) time.sleep(.001) Arm.Arm_serial_servo_write(4, 180, 1000) time.sleep(1) # Control servo 1 for left and right movement Arm.Arm_serial_servo_write(1, 180, 500) time.sleep(.5) Arm.Arm_serial_servo_write(1, 0, 1000) time.sleep(1) # Control servos to return to initial position Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1000) time.sleep(1.5)try : main()except KeyboardInterrupt: print(" Program closed! ") passx
del Arm # Release the Arm objectOpen the program file from Jupyter Lab and click the "Run All Cells" button on the Jupyter Lab toolbar. You will see the robotic arm move up, down, left, and right.

To exit, click the stop button on the toolbar.
