Skip to content

Search the documentation

Kit
Firmware

Motor

Smart Car

One drive motor of the robot (left_motor or right_motor); speeds are in percent.

The Motor class is reached through these attributes of robot.

Can be None.

Can be None.

All the attributes of robot are in its table. Read Attributes that can be None to see when a part is None.

The speed last set, from -100 to 100 percent: negative means backward.

speed: int

Read only.

True when this wheel’s wiring is swapped, so forward turns it the other way.

inverted: bool

You can read it and you can set it.

Turns the wheel forward at a speed from 0 to 100 percent.

forward(speed: int)

You can leave out speed.

Used in examples: Drive a square, Line follower

Turns the wheel backward at a speed from 0 to 100 percent.

backward(speed: int)

You can leave out speed.

Used in examples: Drive a square, Line follower

Turns the wheel at a speed from -100 to 100 percent: positive is forward, negative backward, 0 stops.

drive(speed)

Changes the speed to 0-100 percent and keeps the direction the wheel turns.

set_speed(speed)

Used in examples: Drive a square

Lets the wheel roll to a stop (coast).

stop()

Used in examples: Drive a square, Name your robot, then drive it, Line follower

Stops the wheel at once (active brake).

brake()