How to connect your Arduino to nodejs using duino
Posted at September 09, 2012
In this video I’ll explain how to set up your Arduino and Duino so you can interact with your Arduino using nodejs (and javascript).
- The Arduino software package is downloadable from the Arduino website.
- You can find the Duino module here.
- Installing Duino is as simple as running
npm install duino
. My custom bleep function:
var arduino = require(‘duino’),
board = new arduino.Board();
var led = new arduino.Led({ board: board, pin: 13 });
var bleep = function() {
led.on(); setTimeout(function() { led.off(); }, 100);
}
Troubleshooting:
- You need a recent version of nodejs (0.4.x was not working) for the Duino module.
- If you can’t upload the Arduino program, make sure the right model is selected at Tools -> Board.