Skip to content

Controller for OpenSprints.js using node.js and zetta.js

Notifications You must be signed in to change notification settings

opensprints/opensprints-hw-js

Repository files navigation

This project hosts the OpenSprints USB hub as a RESTful web service.

The hall effect sensors are monitored, LEDs are controlled, and a state machine switches between two states:

  • "waiting": magnets are ignored
  • "counting": magnets switching the hall sensors on and off, causing counters to increment.

A client can monitor the rollers' ticks and transition the state machine between the two states by making HTTP requests.

Here is a client library that is designed to interact with the Siren hypermedia media type.

Running the service:

  1. Install the node dependencies.

  2. Make sure the StandardFirmata sketch is flashed on the OpenSprints USB device's Arduino.

  3. Connect the OpenSprints USB device.

  4. Run:

    node index.js
    

    Depending on which port the Arduino is mounted to, the command may need to be run by the root user:

    sudo node index.js
    
  5. Open http://browser.zettajs.io/#/overview?url=http:%2F%2F127.0.0.1:1337

    This a JavaScript client running in the browser, making requests to the USB monitor running as a RESTful web service API.

    Click on the "start" button under "State Machine Device". The magnet sensor should cause incrementing ticks for the associated "roller" until the State Machine Device's "stop" button is pressed.

About

Controller for OpenSprints.js using node.js and zetta.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published