The Linkbot Class

The linkbot3.Linkbot class is a handle to a remote Linkbot. The class itself contains several child classes that represent various peripherals on the Linkbot, such as the motors, buttons, accelerometer, and LED.

Here is a small piece of sample code showing how to move a Linkbot’s motors using the asynchronous linkbot3.Linkbot object.

import linkbot3 as linkbot

# My Linkbot's ID is 'ZRG6'
l = linkbot.Linkbot('ZRG6')

# move forward by rotating wheels 90 degrees
l.motors.move([90, 0, -90])

# Now move back the same distance
l.motors.move([-90, 0, 90])

# Now set the motion controll to a smooth controller
for motor in l.motors:
    motor.set_controller(linkbot.Motor.Controller.SMOOTH)
    motor.set_accel(30)
    motor.set_decel(30)

# move forward by rotating wheels 90 degrees
l.motors.move([90, 0, -90])

# Now move back the same distance
l.motors.move([-90, 0, 90])

class linkbot3.FormFactor
DONGLE = 3
I = 0
L = 1
T = 2

Linkbot API Documentation

class linkbot3.Linkbot(serial_id='LOCL')
accelerometer

The robot accelerometer.

See linkbot3.peripherals.Accelerometer

battery

The robot battery.

See linkbot3.peripherals.Battery

buttons

Access to the robot’s buttons.

See linkbot3.peripherals.Button

buzzer

Control the Linkbot’s buzzer.

See linkbot3.peripherals.Buzzer

disconnect()

Disconnect from the Linkbot.

form_factor()

Get the form factor of the Linkbot. See linkbot3.FormFactor.

led

Access to the robot’s multi-color LED.

See linkbot3.peripherals.Led.

motors

The motors of the Linkbot.

See linkbot3.peripherals.Motors . To access individual motors, you may do:

Linkbot.motors[0].is_moving()

or similar. Also see linkbot3.peripherals.Motor

version()

Get the firmware version

Return type:(int, int, int)