7.2.3 RGB and IO Control

Start with RGB control because it does not move the robot.

RGB Example

import time
from pymycobot import MyCobot280

mc = MyCobot280(unoq_bridge=True)

while True:
    mc.set_color(255, 0, 0)
    time.sleep(1)
    mc.set_color(0, 255, 0)
    time.sleep(1)
    mc.set_color(0, 0, 255)
    time.sleep(1)

Press Ctrl+C or Stop in App Lab to end the program.

Base IO Example

import time
from pymycobot import MyCobot280

mc = MyCobot280(unoq_bridge=True)

pin = 1
mc.set_basic_output(pin, 1)
time.sleep(1)
mc.set_basic_output(pin, 0)

Confirm the pin mapping and accessory wiring before using IO outputs.

Back to Python Development

results matching ""

    No results matching ""