BB-8
Allows users to interact with the Sphero BB-8 robot using Cylon.js.
For more information click here.
How To Connect
var Cylon = require('cylon'); Cylon.robot({ connections: { bluetooth: { adaptor: 'central', uuid: 'cc360e85785e', module: 'cylon-ble' } }, devices: { bb8: { driver: 'bb8', module: "cylon-sphero-ble" } }, ...
How To Use
var Cylon = require('cylon'); Cylon.robot({ connections: { bluetooth: { adaptor: 'central', uuid: 'cc360e85785e', module: 'cylon-ble' } }, devices: { bb8: { driver: 'bb8', module: 'cylon-sphero-ble' } }, work: function(my) { my.bb8.color(0x00FFFF); after(500, function() { my.bb8.color(0xFF0000); }); after(1000, function() { my.bb8.roll(60, 0); }); after(2000, function() { my.bb8.roll(60, 180); }); after(3000, function() { my.bb8.stop(); }); } }).start();
Commands
roll
Roll the robot
Params
-
speed (
Number
) what speed robot should roll at -
heading (
Number
) what heading robot should roll towards (0-359) -
[state] (
Number
) optional state parameter -
callback (
Function
) function to be triggered after writing
Returns
- (
undefined
)
stop
Stop the robot
Params
-
callback (
Function
) function to be triggered after writing
Returns
- (
undefined
)
color
Sets the RGB color of built-in LED
Params
-
color (
Number
) color value to set -
callback (
Function
) function to call when done
Returns
- (
undefined
)
randomColor
Sets the RGB color built-in LED to random color
Params
-
callback (
Function
) function to call when done
Returns
- (
undefined
)
getColor
Gets the RGB color for built-in LED
Params
-
callback (
Function
) function to call when done
Returns
- (
undefined
)
detectCollisions
Turns on collision detection mode
Params
-
callback (
Function
) function to call when done
Returns
- (
undefined
)
startCalibration
Turns on start calibration mode
Params
-
callback (
Function
) function to call when done
Returns
- (
undefined
)
finishCalibration
Finish calibration mode
Params
-
callback (
Function
) function to call when done
Returns
- (
undefined
)
streamOdometer
Stream odometer data
Params
-
[sps=5] (
Number
) samples per second -
[remove=false] (
Boolean
) forces velocity streaming to stop
Returns
- (
undefined
)
streamVelocity
Stream velocity data
Params
-
[sps=5] (
Number
) samples per second -
[remove=false] (
Boolean
) forces velocity streaming to stop
Returns
- (
undefined
)
streamAccelOne
Stream accelOne data
Params
-
[sps=5] (
Number
) samples per second -
[remove=false] (
Boolean
) forces velocity streaming to stop
Returns
- (
undefined
)
streamImuAngles
Stream ImuAngles data
Params
-
[sps=5] (
Number
) samples per second -
[remove=false] (
Boolean
) forces velocity streaming to stop
Returns
- (
undefined
)
streamAccelerometer
Stream accelerometer data
Params
-
[sps=5] (
Number
) samples per second -
[remove=false] (
Boolean
) forces velocity streaming to stop
Returns
- (
undefined
)
streamGyroscope
Stream gyroscope data
Params
-
[sps=5] (
Number
) samples per second -
[remove=false] (
Boolean
) forces velocity streaming to stop
Returns
- (
undefined
)
streamMotorsBackEmf
Stream motors back EMF data
Params
-
[sps=5] (
Number
) samples per second -
[remove=false] (
Boolean
) forces velocity streaming to stop
Returns
- (
undefined
)
stopOnDisconnect
Auto stop the Sphero when it detects it has become disconnected
Params
-
[remove=false] (
Boolean
) forces velocity streaming to stop -
callback (
Function
) function to call when done
Returns
- (
undefined
)
setHeading
Tell Sphero to adjust orientation
Params
-
heading (
Number
) heading to set as new zero -
callback (
Function
) function to call when done
Returns
- (
undefined
)
spin
Tells robot to spin in place
Params
-
direction (
String
) direction to spin, either "left", or "right" -
speed (
Number
) speed to spin
Returns
- (
undefined
)
setRawMotors
Sets robot raw motor values
Params
-
leftCommand (
String
) left motor command -
leftPower (
Number
) left motor power level -
rightCommand (
String
) right motor command -
rightPower (
Number
) right motor power level
Returns
- (
undefined
)