2.2 KiB
node-lpf2 - A Node.js module to interface with LEGO Power Functions 2.0 components.
Installation
Node.js v8.0+ required.
npm install node-lpf2 --save
node-lpf2 uses the Noble BLE library by Sandeep Mistry. On macOS everything should function out of the box. On Linux and Windows there are certain dependencies which may need installed first.
Note: node-lpf2 has been tested on macOS 10.13 and Debian/Raspbian on the Raspberry Pi 3 Model B.
Compatibility
While most LPF2 components and Hubs are compatible with each other, there are exceptions. There is limited backwards compatibility between newer components and the WeDo 2.0 Smart Hub. However WeDo 2.0 components are fully forwards compatible with newer Hubs.
Type | WeDo 2.0 Smart Hub | Boost Move Hub | Powered Up Hub | |
---|---|---|---|---|
WeDo 2.0 Tilt Sensor | Sensor | Yes | Yes | Yes |
WeDo 2.0 Distance Sensor | Sensor | Yes | Yes | Yes |
WeDo 2.0 Medium Motor | Motor | Yes | Yes | Yes |
Boost Color and Distance Sensor | Sensor | Partial (1) | Yes | Yes |
Boost Interactive Medium Motor | Motor | Partial (2) | Yes | Yes |
Powered Up Train Motor | Motor | Yes | Yes | Yes |
(1) Only color mode is supported on the WeDo 2.0 Smart Hub at this point.
(2) When used with the WeDo 2.0 Smart Hub, the Boost Interactive Medium Motor functions like the WeDo 2.0 Medium Motor - that is, only basic constant speed is possible. However the rotation sensing functionality is supported.
Usage
const LPF2 = require("node-lpf2").LPF2;
const lpf2 = new LPF2();
Examples are available in the "examples" directory.