Skip to content
 
 

Repository files navigation

toio.js

Library for controlling toio™Core Cube using Node.js

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 cube
  cube.move(100, 100, 1000)
  //         |    |     `--- duration [ms]
  //         |    `--------- right motor speed
  //          `------------- left motor speed
}

main()

💻 Prerequisites

✅ Verified Environment

Windows (10)

On Windows, we need additional settings (C++, python and special driver for BLE adapter). Please see noble's setup guide mentioned above.

macOS (10.12, 10.13 and 10.14)

We recommend 10.13 (High Sierra) and 10.14 (Mojave). On 10.12 (Sierra), the frequency of BLE notify event is slower than 10.13, 10.14 or Windows. This affects position correction logic (like used in chase sample).

Linux (not verified yet)

Not verified yet, we are waiting for your report.

📦 Packages

Package name Readme Description
@toio/scanner packages/scanner Cube scanner
@toio/cube packages/cube Cube BLE API wrapper

🎮 Example

How to play sample application

git clone https://github.com/toio/toio.js.git   # clone repository
cd toio.js                                      # move to repository root
yarn install                                    # install dependencies
yarn build                                      # build @toio/* packages
yarn example:<name of example>                  # start sample application (see below)

If yarn command is not existed, type npm install -g yarn to install.

List of sample application

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

About

Library for controlling toio™Core Cube

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages