Skip to content

A node library that wraps node sense hat sensors into a simple API with the same methods as pi-sense-hat-remote-simulator package for easy swapping production and simulation modes.

License

Notifications You must be signed in to change notification settings

joanjane/pi-sense-hat-library

Repository files navigation

pi-sense-hat-library

A node library that wraps node sense hat sensors into an unified API. Build node SenseHat apps easily taking advantage of the alter ego library for simulating sensehat for easier development pi-sense-hat-remote-simulator.

Dependencies:

(this dependecies also require to have installed this packages and only working under linux: python make g++ linux-headers)

Usage

Check out samples section

The client library is built with ESM modules and is also distributed as "classic" CommonJS modules for compatibility. There are 4 modules available:

  • Display (led matrix, messaging display)
  • Joystick (joystick)
  • EnvironmentSensors (temperature, humidity, pressure)
  • MotionSensors (acceleromenter, gyroscope, orientation, compass)
    // setup using CommonJS modules
    const { Display, Joystick, EnvironmentSensors, MotionSensors } = require('pi-sense-hat-library/cjs');
    const display = new Display();
    const joystick = new Joystick();
    const environmentSensors = new EnvironmentSensors();
    const motionSensors = new MotionSensors();

    
    // setup using ESM modules
    import { Display, Joystick, EnvironmentSensors, MotionSensors } from 'pi-sense-hat-library';
    const display = new Display();
    const joystick = new Joystick();
    const environmentSensors = new EnvironmentSensors();
    const motionSensors = new MotionSensors();

Development

For development, it is possible to use a docker image with all dependencies installed where you can develop on mounting the source files from host machine to container. Running run-dev-shell.ps1 script will start a container with a bash shell. Then you can install packages with npm i.

This library is developed using ESM modules and is transpiled to CommonJS modules with npm run build:lib command.

Samples

About

A node library that wraps node sense hat sensors into a simple API with the same methods as pi-sense-hat-remote-simulator package for easy swapping production and simulation modes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages