Install from Github:
npm install --save https://github.com/wind-rider/nuimo-client.ts/releases/download/v0.4.0/nuimo-client-ts-0.4.0.tgz
npm install -g typings # to install the typings manager
typings install --ambient noble node # to install the required typimgs
A simple client library for communicating with the senic nuimo, via the BLE (Bluetooth Low Energy) API (read more here).
You can use it with TypeScript, but also with Javascript ES6.
import * as Nuimo from "nuimo-client-ts";
// log updates
Nuimo.withNuimo().then(
nuimo =>
nuimo.listen(function(update) {
console.log(update.type);
if (update instanceof Nuimo.SwipeUpdate) {
console.log("casting test");
let swipeUpdate = <Nuimo.SwipeUpdate>update;
console.log(swipeUpdate.direction);
}
}
));
The fly update was added based on the documentation, but I do not have a real device to test with so please let me know whether it works.
This library was developed TypeScript 1.8.9 and compiles against ES6 for Promises and async support. Support for ES6 is built into Node 4 and higher.
Make sure that you use the following settings in tsconfig.json
if you use TypeScript:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node"
}
}
This package depends on the typings listed in `typings.json` (currently noble and node).
The easiest is to install ts-node:
npm install -g ts-node
Then run the examples:
ts-node ./examples/cycle-leds.ts
ts-node ./examples/leds.ts
ts-node ./examples/leds-multiple-nuimos.ts
ts-node ./examples/serialise.ts
Install the dependencies:
npm install -g gulp
npm install
typings install
Run gulp:
gulp build
This project was ported from https://github.com/AKST/nuimo-client.js and https://github.com/brendonparker/nuimo-client.js to create a TypeScript version that also supports more than one Nuimo. Thanks go to them for creating the basis of this package.
This is my first TypeScript package and as such you might see room for improvement. Please create an issue or pull request to give feedback and share your ideas!
Things I could use help with:
- Distribution of the typings dependencies in the NPM package
- Improvement of the project structure and code structure
- Writing tests