For this project we're gonna need Node, NPM or Yarn, Git (optional) and Arduino IDE.
Hardware: Arduino and 1 x LED (any color).
Downloads:
Node: https://nodejs.org/en/download/
Arduino IDE: https://www.arduino.cc/en/Main/Software
Yarn: https://yarnpkg.com/en/docs/install
NPM: Already bundled with Node. (Ubuntu: sudo apt-get install npm).
Note: Installation of these are really simple so I'm not gonna include the instructions here.
Diagram:
Code repo: https://github.com/geradrum/johnny-five-led-sockets
First step:
We're gonna plug our Arduino to the PC and open the example StandardFirmata.
File > Examples > Firmata > StandarFirmata
and upload it to the board.
This allows us to use Johny Five and the Firmata Protocol to connect us to the board using Javascript (in this case).
Second step:
Clone the code repo using git or download it directly from the GitHub page.
Go to the folder where the code you downloaded is located from the terminal using cd
Example: cd /user/home/my-username/johnny-five-led-sockets
We're gonna run npm install or yarn install (if you're using yarn) to download all the dependencies we need to run this project.
Third step:
Once you have finished downloading all the dependencies the last thing to do is run the scripts for this project.
Starts a local server for this project.
npm run dev
Build the project to the /dist folder (html/css/js).
npm run build
Starts a local server for this project and runs the arduino.js file
npm run arduino:dev
Runs the arduino.js file without starting a local server, instead, the script connects to the production server.
npm run arduino
Optional:
The project is ready to deploy, I used heroku but you can use the service you want.
If you run the project as development mode you can access to it at: http://localhost:4000/
Screenshots
Screenshots of the web interface:
Off
On
Comments
Please log in or sign up to comment.