Get unlimited public & private packages + team-based management with npm Teams.Learn more »

sense-hat-joystick

0.2.0 • Public • Published

NodeJS Sense Hat Joystick

This module enables you to listen for joystick events (up, down, left, ..) with not external dependencies.

Example

const Joystick = require("sense-hat-joystick").Joystick;
const joystick = new Joystick();
 
// possible events: left, right, up, down and enter
joystick.on("left", () => {
    console.log("left pressed");
});

Additionally, you can stop listening events by calling .end(). The code uses an open file descriptor to listen for the events, so if you stop listening you can forget about the instance and recreate a new one if you need events again.

Install

npm i sense-hat-joystick

DownloadsWeekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

3.57 kB

Total Files

4

Last publish

Collaborators

  • avatar