Arduino + NodeJS + Johnny-5

Well, one of my dreams was to be able to program my Arduino UNO using NodeJS. And guess what? Recently I found out about Johnny-Five which allows you to write any logic on Node!

Want to try it out? Here is what you have to do (Extra super quick semi-tutorial):

  1. Create any JavaScript project (I used WebStorm).
  2. Install NodeJS on your system.
  3. Create package.json or run npm init to generate it automatically.
  4. Create any file (myapp.js).
  5. Download and install Arduino IDE (here).

Once you followed all steps, you can get a sample code (I recommend start from Hello World) and paste it in your created myapp.js.

You are almost done! Now plug in your board to USB, and run node myapp.js to upload the logic.

What? Did you hit an error like Please check that you've properly flashed the board with the correct firmware. See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting?
It means we need to flush a standard StandardFirmataPlus firmware. That's why we downloaded Arduno IDE for this scenario...

Tutorial on Instructables shows an easy way to flush a firmware straight from included examples.

Now try to run node myapp.js again and you should be able to see your first NodeJS-powered Arduino!

Hope it worked! :)

0 Comments
Loading...