This app plots the values a potentiometer and turns on an LED if a voltage threshold is crossed
Connect an LED directly to pin 12 and a potentiometer to A0
To run, first clone the repo and npm install the example directory
git clonecd electron-johnny-five-examples/7-sensor-lednpm install
Unfortunately the serial port may not work right away and might need to be rebuilt
At this point if you try to starting the app with
You may get an error if the path to
serialport.node is wrong
Uncaught Error: Cannot find module '/Users/sofroniewn/github/electron-johnny-five-examples/1-led/node_modules/johnny-five/node_modules/serialport/build/Release/node-v47-darwin-x64/serialport.node'
This can easily be fixed by
mv ./node_modules/johnny-five/node_modules/serialport/build/Release/electron-v0.36-darwin-x64/ ./node_modules/johnny-five/node_modules/serialport/build/Release/node-v47-darwin-x64/
You're now ready to run the app!
Once the board has been found and the green status light in the top right has turned on, you should be able to click the start button in the top left corner. Sensor values will then start being acquired and plotted to the screen using a lightning vizualization. If these values exceed a threshold the LED will turn on.
Congrats! Check out the next example 8-sensor-strobe