A simple example of using a Puck.js button as a remote control.
It misuses the puck's battery level advertisement to indicate whether the button has been pressed.
Whilst idle, its battery level is set to 0. When the button is clicked once, the red LED comes on for 3 seconds and the battery level is set to 10. A double click sets the green LED and a battery level of 20. A triple click sets the blue LED and a battery level of 30.
This repository includes a node.js app that listens for the changes in advertised values and prints them out.
puck/puck.js
is a sketch to upload to your puck deviceindex.js
is a node.js app that listens for device advertisements and prints out values that change.
- Open up the Espruino Web IDE
- Connect to your puck device
- Upload the sketch from
puck/puck.js
- Disconnect
- Run
npm install
in the root of this repository - Run
node index.js