Case 1

Set the color of the end lights to blue

from pymycobot import Mercury

ml = Mercury("/dev/ttyTHS0")
mr = Mercury("/dev/ttyACM0")
# Robot powered on
ml.power_on()
mr.power_on()

ml.set_color(0,0,255)
mr.set_color(0,0,255)

Case 2

Angle control

from pymycobot import Mercury
import time
ml = Mercury("/dev/ttyTHS0")
mr = Mercury("/dev/ttyACM0")
# Robot powered on
ml.power_on()
mr.power_on()
# Single angle control
ml.send_angle(1, 90, 40)
mr.send_angle(1, 90, 40)
time.sleep(3)
ml.send_angle(1, 0, 40)
mr.send_angle(1, 0, 40)
time.sleep(3)

# All angle controls
ml.send_angles([0, 0, 90, 0, 0, 90, 0], 40)
mr.send_angles([0, 0, 90, 0, 0, 90, 0], 40)
time.sleep(3)
ml.send_angles([0, 0, 0, 0, 0, 90, 0], 40)
mr.send_angles([0, 0, 0, 0, 0, 90, 0], 40)

← Previous Page | Next Page →

results matching ""

    No results matching ""