This app allows you to control an LED
Setting up the hardware
Connect an LED directly to pin 12
Setting up the code
To run, first clone the repo and npm install the example directory
git clone https://github.com/sofroniewn/electron-johnny-five-examples cd electron-johnny-five-examples/1-led npm 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!
Running the app
You should see a screen that looks like this:
The Click me! button is currently disabled and the board status light in the top right corner is grey while the app tries to connect to the board.
Once the board has been found and is ready the status light will turn green and Click me! button will become enabled. The screen should now look like this:
If you press Click me! the LED should turn on!!!
Congrats! Check out the next example 2-switch