Skip to content
This repository has been archived by the owner on May 30, 2018. It is now read-only.

Latest commit

 

History

History
40 lines (29 loc) · 1.13 KB

README.md

File metadata and controls

40 lines (29 loc) · 1.13 KB

Node Arduino

This package is designed to allow you to control and program an arduino chipset with JavaScript. It leverages the node-serialport code base, so ensure that you have that installed. In order to see what this package can do, please watch this presentation from JSConf EU 2010 by Nikolai Onken and Jörn Zaefferer.

How To Use

Using node-arduino is pretty easy because it is pretty basic. It is essentially a wrapper with arduino specific message handling around the node-serialport library.

To Install

npm install git://github.com/kyungw00k/node-arduino.git

To Use

  • Opening an arduino board:
var arduino = require("arduino") 
  , myBoard = arduino.connect("/dev/tty-usbserial1");
  • Getting pin 7 digital value
var arduino = require("arduino")
  , myBoard = arduino.connect("/dev/tty-usbserial1");

myBoard.pinMode(7, arduino.INPUT);

setInterval(function () {
  myBoard.digitalRead(7, function(data) {
	console.log(data);
  });
}, 100);