Sphero Connector Core
This is a thin (and partial) wrapper around the unofficial Sphero V2 API for Sphero toys use 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, each of these methods will return an object with the following structure:
{
wake: function() { ... },
sleep: function() { ... },
setMainLedColor: function(hexColor: string) { ... }
}
Example: Connect Sphero Mini and set main LED color 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.