sphero-connector-core
v0.0.5
Published
A thin wrapper round spherov2.js (unofficial API for Sphero® toys)
Downloads
3
Maintainers
Readme
Sphero Connector Core
This is a thin (and partial) wrapper around the unofficial Sphero V2 API for Sphero toys used by Sphero Connector HTTP and Sphero Connector IPC.
API
Connect Toy
The following methods try to find a toy and establish a connection with it.
async connectSpheroMini()
async connectSpheroMiniWithName(toyName: string)
async connectLightningMcQueen()
async connectR2D2()
async connectR2Q5()
async connectBB9E()
async connectToy(toyType: string, toyName: string)
Valid values for toyType
are: SpheroMini
, LightningMcQueen
, R2D2
, R2Q5
, BB9E
.
If a toy is found and connected, an object with the following structure is returned.
{
wake: function() { ... },
sleep: function() { ... },
setMainLedColor: function(hexColor: string) { ... }
}
Example: Connect Sphero Mini and set main LED color to red
const connector = require('sphero-connector-core');
const spheroMini = await connector.connectSpheroMini();
spheroMini.setMainLedColor('#FF0000');
License
Please be aware of the licenses of the components used in this project. Everything else that has been developed by the contributions to this project is under MIT License.