๐ Wiring
Connect the motor driver: o3/o4 = right motor, o5/o6 = left motor.
Tell the board which pins are motors in setup. Then robot_control(left, speed, right, speed) drives: "F" forward, "B" backward, "S" stop.
from tinkerpy_mega import * from motor import * def setup(): set_function(o3, MOTOR_RIGHT_FORWARD) set_function(o4, MOTOR_RIGHT_BACKWARD) set_function(o5, MOTOR_LEFT_FORWARD) set_function(o6, MOTOR_LEFT_BACKWARD) def loop(): robot_control("F", 80, "F", 80) wait(1000) robot_control("B", 80, "F", 80) wait(500)
๐ก Tip
Left wheel backward + right wheel forward = spin left on the spot.
๐ Your turn
Make the robot drive in a big circle: both forward, but one wheel slower.