Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
firmata protocol implemented in javascript
tree: c531256c8c

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
readme.md
repl.js

readme.md

firmata.js

A Node library to interact with an arduino running the firmata protocol.

Requirements

Node
Arduino running firmata (tested with v2.2)
node-serialport https://github.com/voodootikigod/node-serialport

Usage

var firmata = require('..lib/firmata');
var board = new firmata.Board('path to usb',function(){
  //arduino is ready to communicate
});  

View test folder for examples.

Methods:

board.digitalWrite(pin,value)
Write an output to a digital pin. pin is the number of the pin and the value is either board.HIGH or board.LOW

board.pinMode(pin,state)
Set a mode for a pin. pin is the number of the pin and state is one of the following. board.INPUT, board.OUTPUT, board.PWM

board.analogWrite(pin,value)
Write an output to a digital pin. pin is the number of the pin and the value is between 0 and 255.

board.analogRead(pin,callback)
Read an input for an analog pin. Every time there is data on the pin the callback will be fired.

Something went wrong with that request. Please try again.