npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

movehub

v0.4.1

Published

Interface to the Lego Boost Move Hub

Readme

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

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