Service_SPIKE.MotorPair

MotorPair

Example

var pair = new serviceSPIKE.MotorPair("A", "B")

Methods

inner set_motor_rotation(amount, unit)

Sets the ratio of one motor rotation to the distance traveled.

If there are no gears used between the motors and the wheels of the Driving Base, then amount is the circumference of one wheel.

Calling this method does not affect the Driving Base if it is already currently running. It will only have an effect the next time one of the move or start methods is used.

Parameters:
Name Type Description
amount number
unit string

'cm','in'

inner start_tank(left_speed, right_speed)

Starts moving the Driving Base

Parameters:
Name Type Description
left_speed integer

[-100 to 100]

right_speed integer

[-100 to 100]

Example
pair.start_tank(100,100);

inner start_tank_at_power(leftPower, rightPower)

Starts moving the Driving Base

Parameters:
Name Type Description
leftPower integer

[-100 to 100]

rightPower integer

[-100 to 100]

Example
pair.start_tank_at_power(10, 10);

inner stop()

Stops the 2 motors simultaneously, which will stop a Driving Base.

Example
pair.stop();