node-wedo
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

node-wedo - A Javascript module to interface with LEGO WeDo (1.0).

Installation

Node.js v8.0+ required.

npm install node-wedo --save

Example

const WeDo = require("node-wedo");

const weDo = new WeDo.WeDo();

(async () => {

    weDo.connect();
    weDo.on("tilt", (port, { tilt }) => {
        if (tilt === WeDo.Consts.TiltEvent.FORWARD) {
            weDo.setPower("B", 100);
        } else if (tilt === WeDo.Consts.TiltEvent.BACK) {
            weDo.setPower("B", -100);
        } else if (tilt === WeDo.Consts.TiltEvent.NONE) {
            weDo.setPower("B", 0);
        }
    });

})();

More examples available in the examples directory.

Readme

Keywords

none

Package Sidebar

Install

npm i node-wedo

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

21.1 kB

Total Files

14

Last publish

Collaborators

  • nathankellenicki