All Projects → hobbyquaker → node-movehub

hobbyquaker / node-movehub

Licence: MIT license
Node.js interface for the Lego Boost Move Hub 🤖 🐱 🎸 🚚

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-movehub

Pyb00st
Python for LEGO BOOST
Stars: ✭ 125 (+119.3%)
Mutual labels:  boost, ble
react-native-google-nearby-messages
📲 Communicate with nearby devices using Bluetooth, BLE, WiFi and near-ultrasonic audio. Broadcast and receive small payloads (like strings) using the easy-to-use React Native API!
Stars: ✭ 143 (+150.88%)
Mutual labels:  ble
ESP32BleAdvertise
Simple library for BLE advertise using ESP32 in Arduino
Stars: ✭ 39 (-31.58%)
Mutual labels:  ble
node-typescript-starter
REST API using Node with typescript, KOA framework. TypeORM for SQL. Middlewares JWT (auth), CORS, Winston Logger, Error, Response
Stars: ✭ 19 (-66.67%)
Mutual labels:  node-module
origami-build-tools
Standard Origami component development tools.
Stars: ✭ 49 (-14.04%)
Mutual labels:  node-module
ufw
A minimalist framework for rapid server side applications prototyping in C++ with dependency injection support.
Stars: ✭ 19 (-66.67%)
Mutual labels:  boost
ESP-Alerts-for-Android
Send Android Notifications to an ESP32 with OLED display
Stars: ✭ 42 (-26.32%)
Mutual labels:  ble
ldview
Real-time 3D viewer for displaying LDraw models
Stars: ✭ 65 (+14.04%)
Mutual labels:  lego
bluetooth-iot-service-python
This application connects two devices over Bluetooth and allows one to send messages to the other using json. Raspberry Pi Bluetooth interfacing with Linux via RFCOMM BT network
Stars: ✭ 23 (-59.65%)
Mutual labels:  ble
djb2a
DJB2a non-cryptographic hash function
Stars: ✭ 31 (-45.61%)
Mutual labels:  node-module
GoFIT SDK Android
GoFIT SDK for Android — GOLiFE 手環 App 介接 SDK
Stars: ✭ 32 (-43.86%)
Mutual labels:  ble
Boost-Python-Examples
Implementation of C++ Boost Python Examples, With python3.5+ support
Stars: ✭ 34 (-40.35%)
Mutual labels:  boost
node-screenlogic
Pentair ScreenLogic Javascript library using Node.JS
Stars: ✭ 38 (-33.33%)
Mutual labels:  node-module
mi-lamp-re
💡 Reverse Engineering Notes for the Yeelight Bedside Lamp (BLE)
Stars: ✭ 35 (-38.6%)
Mutual labels:  ble
pymetawear
Community developed SDK around the Python bindings for the C++ SDK
Stars: ✭ 42 (-26.32%)
Mutual labels:  ble
EpicGraphQL
Research about the Epic's non-documented Graphql API and main API, using Fiddler and Developer Tools to find requests and add them.
Stars: ✭ 22 (-61.4%)
Mutual labels:  hub
crc16
A native node addon to calcalate and verify CRC16 values, adopted by MODBUS agreement
Stars: ✭ 24 (-57.89%)
Mutual labels:  node-module
powered-up
.NET implementation of the LEGO PoweredUp Protocol
Stars: ✭ 65 (+14.04%)
Mutual labels:  lego
BLELib
This library contains many of the features you need to interact with BLE peripherals
Stars: ✭ 21 (-63.16%)
Mutual labels:  ble
bluetooth stack
这是一个开源的双模蓝牙协议栈(bluetooth.stack)(btstack),可以运行在STM32,Linux.,包含HCI,L2CAP,SDP,RFCOMM,HFP,SPP,A2DP,AVRCP,AVDTP,AVCTP,OBEX,PBAP等协议,后续会继续维护,以达到商用的目的
Stars: ✭ 204 (+257.89%)
Mutual labels:  ble

movehub

NPM version dependencies Status Build Status XO code style License

Node.js interface for the Lego Boost Move Hub 🤖 🐱 🎸 🚚

Install

$ npm install movehub

If you want to utilize the new async/await syntax see https://github.com/ttu/node-movehub-async which is based on this module.

Usage example

See test.js.

API

Classes

Boost
Hub

Boost

Kind: global class

boost.connect(address, callback)

Kind: instance method of Boost

Param Type Description
address string MAC Address of the Hub
callback connectCallback

"ble-ready" (bleReady)

Kind: event emitted by Boost

Param Type Description
bleReady boolean reports true/false when BLE is active

"hub-found" (hub)

Fires when a Move Hub is found

Kind: event emitted by Boost

Param Type
hub object
hub.uuid string
hub.address string
hub.localName string

boost.connectCallback : function

Kind: instance typedef of Boost

Param Type Description
error null | error
hub Hub instance of the Hub Class

Hub

Kind: global class

hub.disconnect()

Disconnect from Move Hub

Kind: instance method of Hub

hub.motorTime(port, seconds, [dutyCycle], [callback])

Run a motor for specific time

Kind: instance method of Hub

Param Type Default Description
port string | number possible string values: A, B, AB, C, D.
seconds number
[dutyCycle] number 100 motor power percentage from -100 to 100. If a negative value is given rotation is counterclockwise.
[callback] function

hub.motorTimeMulti(seconds, dutyCycleA, dutyCycleB, callback)

Run both motors (A and B) for specific time

Kind: instance method of Hub

Param Type Description
seconds number
dutyCycleA number motor power percentage from -100 to 100. If a negative value is given rotation is counterclockwise.
dutyCycleB number motor power percentage from -100 to 100. If a negative value is given rotation is counterclockwise.
callback function

hub.motorAngle(port, angle, [dutyCycle], [callback])

Turn a motor by specific angle

Kind: instance method of Hub

Param Type Default Description
port string | number possible string values: A, B, AB, C, D.
angle number degrees to turn from 0 to 2147483647
[dutyCycle] number 100 motor power percentage from -100 to 100. If a negative value is given rotation is counterclockwise.
[callback] function

hub.motorAngleMulti(angle, dutyCycleA, dutyCycleB, callback)

Turn both motors (A and B) by specific angle

Kind: instance method of Hub

Param Type Description
angle number degrees to turn from 0 to 2147483647
dutyCycleA number motor power percentage from -100 to 100. If a negative value is given rotation is counterclockwise.
dutyCycleB number motor power percentage from -100 to 100. If a negative value is given rotation is counterclockwise.
callback function

hub.led(color, [callback])

Control the LED on the Move Hub

Kind: instance method of Hub

Param Type Description
color boolean | number | string If set to boolean false the LED is switched off, if set to true the LED will be white. Possible string values: off, pink, purple, blue, lightblue, cyan, green, yellow, orange, red, white
[callback] function

hub.subscribe(port, [option], [callback])

Subscribe for sensor notifications

Kind: instance method of Hub

Param Type Default Description
port string | number e.g. call .subscribe('C') if you have your distance/color sensor on port C.
[option] number 0 Unknown meaning. Needs to be 0 for distance/color, 2 for motors, 8 for tilt
[callback] function

hub.unsubscribe(port, [option], [callback])

Unsubscribe from sensor notifications

Kind: instance method of Hub

Param Type Default Description
port string | number
[option] number 0 Unknown meaning. Needs to be 0 for distance/color, 2 for motors, 8 for tilt
[callback] function

hub.write(data, callback)

Send data over BLE

Kind: instance method of Hub

Param Type Description
data string | Buffer If a string is given it has to have hex bytes separated by spaces, e.g. 0a 01 c3 b2
callback function

"rssi" (rssi)

Kind: event emitted by Hub

Param Type
rssi number

"disconnect"

Kind: event emitted by Hub

"connect"

Fires when a connection to the Move Hub is established

Kind: event emitted by Hub

"port" (port)

Fires on port changes

Kind: event emitted by Hub

Param Type
port object
port.port string
port.action string

"color" (color)

Kind: event emitted by Hub

Param Type
color string

"distance" (distance)

Kind: event emitted by Hub

Param Type Description
distance number distance in millimeters

"tilt" (tilt)

Kind: event emitted by Hub

Param Type
tilt object
tilt.roll number
tilt.pitch number

"rotation" (rotation)

Kind: event emitted by Hub

Param Type
rotation object
rotation.port string
rotation.angle

Contributing

Pull Requests welcome! :-)

Credits

Thanks to Jorge Pereira who analyzed and documented the move hub ble protocol: https://github.com/JorgePe/BOOSTreveng

Disclaimer

LEGO and BOOST are Trademarks from The LEGO Company, which does not support (most probably doesn't even know about) this project. And of course I'm not responsible for any damage on your LEGO BOOST devices - use it at your own risk.

License

MIT (c) Sebastian Raff

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].