Skip to content

Instantly share code, notes, and snippets.

@dcesiel
Created August 27, 2012 00:31
Show Gist options
  • Save dcesiel/3484666 to your computer and use it in GitHub Desktop.
Save dcesiel/3484666 to your computer and use it in GitHub Desktop.
A simple of how to control an Arduino running firmata with Node.js
var firmata = require('firmata');
var board = new firmata.Board('/dev/cu.usbserial-A600491U',function(){
console.log('Connected to Arduino');
console.log('Firmware: ' + board.firmware.name +
'-' + board.firmware.version.major +
'.' + board.firmware.version.minor);
console.log('Enabling motor 1');
board.pinMode(4, board.MODES.OUTPUT);
setInterval(function(){
board.digitalWrite(4, board.HIGH);
board.analogWrite(5, 255);
},5)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment