Created
August 27, 2012 00:31
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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