Powered by TinkerSpace
Join free
TinkerPy App lessons
๐Ÿš—
Lesson 5 of 8 ยท Maker ยท 15 min

Robot car remote

Drive your robot with the big Drive Pad widget.

  1. Add the Drive Pad (in Input โ†’ Vehicle Control). It is a big 2ร—2 widget.
  2. It sends F front, B back, L left, R right and S stop.
  3. Hold an arrow to drive โ€” let go and it sends Stop.
  4. Put the board code below on your robot.

Board code

Put this on your TinkerPy board with TinkerPy Projects:

Board
from tinkerpy_mega import *

from motor import *
from bluetooth import *

def setup():
    bluetooth_begin()  # switches Bluetooth on when the board starts
    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():
    bt = bluetooth_read_char()
    if bt == 'F':
        robot_control("F", 80, "F", 80)
    elif bt == 'B':
        robot_control("B", 80, "B", 80)
    elif bt == 'L':
        robot_control("B", 70, "F", 70)
    elif bt == 'R':
        robot_control("F", 70, "B", 70)
    elif bt == 'S':
        robot_control("S", 0, "S", 0)
Chat with TinkerPy ๐Ÿ‘‹