move-steering v0.1.47
move-steering
to make motors move at the same time
Installation
$ npm install move-steering
Usage
var MoveSteering = require('move-steering')
MoveSteering('b', 'c').degrees(360, 300, 0) // move straight for 1 motor rotation
MoveSteering().timed(2000, 300, 100) // turn right for 2 seconds
API
MoveSteering(leftPort, rightPort)
leftPort
- port letter of the left motor. defaults to 'b'.rightPort
- port letter of the right motor. defaults to 'c'.
Returns: a move steering instance that controls two motors
.forever(speed, turn, opts)
Run both motors until they receive a stop command.
speed
- speed at which to run the motorsturn
- number between -100 and 100 to denote amount of turning. -100 is maximum left turn. 0 is straight. 100 is maximum right turn.opts
- an object of optional parameters
.degrees(degrees, speed, turn)
Run both motors for a number of degrees with the ability to turn.
degrees
- number of degrees for the motor to spinspeed
- speed at which to run the motorsturn
- number between -100 and 100 to denote amount of turning. -100 is maximum left turn. 0 is straight. 100 is maximum right turn.
.rotations(rotations, speed, turn)
Run both motors with a number of degrees the ability to turn.
rotations
- number of rotations for the motor to spinspeed
- speed at which to run the motorsturn
- number between -100 and 100 to denote amount of turning. -100 is maximum left turn. 0 is straight. 100 is maximum right turn.
.timed(time, speed, turn)
Run both motor for a specified amount of time.
time
- time in millisecondsspeed
- speed at which to run the motorsturn
- number between -100 and 100 to denote amount of turning. -100 is maximum left turn. 0 is straight. 100 is maximum right turn.
.stop()
Stop both motors.
.reset()
Reset both motors.
License
MIT
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago