Library for controlling toio™Core Cube using Node.js.
- Node.js >= 10
- This library depends on @abandonware/noble.
- As far as I confirmed, additional libraries are not required.
Install toio.js using yarn
.
If yarn
command is not existed, type npm install -g yarn
to install.
yarn install
yarn build
Here is a quick example to get you started.
const { NearestScanner } = require('@toio/scanner')
async function main() {
// start a scanner to find the nearest cube
const cube = await new NearestScanner().start()
// connect to the cube
await cube.connect()
// move the cube
cube.move(100, 100, 1000)
// | | `--- duration [ms]
// | `--------- right motor speed
// `-------------- left motor speed
}
main()
Raspbian GNU/Linux 9.11 on Model B+
Package name | Readme | Description |
---|---|---|
@toio/scanner | packages/scanner | Cube scanner |
@toio/cube | packages/cube | Cube BLE API wrapper |
sudo yarn example:<name of example> # start sample application (see below)
Do not forget sudo
Name & Source | Command | #cubes | Mat | Description |
---|---|---|---|---|
id-reader | yarn example:id-reader |
1 | Yes | read & show toio ID information |
keyboard-control | yarn example:keyboard-control |
1 | No | move a cube with ↑↓←→ |
chase | yarn example:chase |
2 | Yes | a cube chase another one |
- This repo is for research use