chrkhl / sphero-connector-core

A thin (and partial) wrapper around the (unofficial) Sphero V2 API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm version Dependency Status devDependency Status Build Status Coverage

Sphero Connector Core

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.

About

A thin (and partial) wrapper around the (unofficial) Sphero V2 API

License:MIT License


Languages

Language:JavaScript 100.0%