Continous Servo
Provides an interface for making servos easy to work and interact with from Cylon.js.
For more information click here.
How To Connect
Cylon.robot({ connections: { arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' } }, devices: { servo: { driver: 'continuous-servo', pin: 3 } }, });
How To Use
This example moves a servo from angle 45 to 90 to 135.
var Cylon = require('cylon'); Cylon.robot({ connections: { arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' } }, devices: { servo: { driver: 'continuous-servo', pin: 3 } }, work: function(my) { var clockwise = true; my.servo.clockwise(); every((1).second(), function() { if (clockwise) { my.servo.counterClockwise(); clockwise = false; } else { my.servo.clockwise(); clockwise = true; } }); } }).start();
Commands
stop
Stops the Continuous Servo's rotation
Params
-
callback (
Function
) (err, val) triggers when write is complete
Returns
- (
undefined
)
clockwise
Rotates the Continuous Servo clockwise
Params
-
[callback] (
Function
) - (err, val) triggers when write is complete
Returns
- (
undefined
)
counterClockwise
Rotates the Continuous Servo counter-clockwise
Params
-
[callback] (
Function
) - (err, val) triggers when write is complete
Returns
- (
undefined
)
rotate
Rotates the Continuous Servo
Params
-
direction (
String
) 'clockwise' or 'counter-clockwise' -
[callback] (
Function
) - (err, val) triggers when write is complete
Returns
- (
undefined
)