Module Motor :: Class Motor
[hide private]
[frames] | no frames]

Class Motor

source code

Class that represents a motor.

Instance Methods [hide private]
 
__init__(self, id)
Creates a motor instance with given id.
source code
 
_setup(self, robot) source code
 
forward(self)
Starts the forward rotation with preset speed.
source code
 
backward(self)
Starts the backward rotation with preset speed.
source code
 
stop(self)
Stops the motor.
source code
 
setSpeed(self, speed) source code
 
_checkRobot(self) source code
Method Details [hide private]

__init__(self, id)
(Constructor)

source code 

Creates a motor instance with given id.

Parameters:
  • id - 0 for left motor, 1 for right motor

forward(self)

source code 

Starts the forward rotation with preset speed. The method returns immediately, while the rotation continues.

backward(self)

source code 

Starts the backward rotation with preset speed. The method returns immediately, while the rotation continues.

stop(self)

source code 

Stops the motor. (If motor is already stopped, returns immediately.)