An open API service indexing awesome lists of open source software.

https://github.com/danielesteban/node-arduino

Node module to interact with the Arduino
https://github.com/danielesteban/node-arduino

Last synced: 3 days ago
JSON representation

Node module to interact with the Arduino

Awesome Lists containing this project

README

          

node-arduino
============

A node module for interfacing with the Arduino

**Installation:**

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

**Usage:**

```javascript
var Arduino = require('arduino');

Arduino.on('req', function(device, func, data) {
switch(func) {
case 0:
//Do something
break;
case 1:
//Do something else
break;
}
});

Arduino.on('error', function(err) {
console.log(err);
});

Arduino.connect('/dev/tty.usbserial', function() {
console.log('Connection successful');
});

//To send a Request to the arduino:
var device_id = 1,
func = 255,
data = new Buffer(['d', 'a', 't', 'a']);

Arduino.req(device_id, func, data, function(data) {
//Do something with the returned value
});

//There's also a helper for sending large numbers (like timestamps)...
Arduino.req(1, 0, Arduino.numToBuffer(3141592653));
```

**License:**

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the [GNU General Public License](https://github.com/danielesteban/node-arduino/blob/master/LICENSE)
along with this program. If not, see .