🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

arduino-firmata

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arduino-firmata - npm Package Compare versions

Comparing version

to
0.2.0

samples/sysex/README.md

@@ -0,1 +1,5 @@

=== 0.2.0 2014-01-28
* implement sysex(cmd, data_array) #6
=== 0.1.0 2014-01-27

@@ -5,2 +9,3 @@

* implement on("digitalChange", callback) #8
* fix socket.io sample

@@ -7,0 +12,0 @@ === 0.0.5 2014-01-27

21

lib/arduino-firmata.js

@@ -149,2 +149,6 @@ (function() {

ArduinoFirmata.prototype.reset = function() {
return this.write([ArduinoFirmata.SYSTEM_RESET]);
};
ArduinoFirmata.prototype.write = function(bytes) {

@@ -154,2 +158,14 @@ return this.serialport.write(bytes);

ArduinoFirmata.prototype.sysex = function(command, data) {
if (data == null) {
data = [];
}
data = data.map(function(i) {
return i & 0x7f;
});
this.write([ArduinoFirmata.START_SYSEX, command]);
this.write(data);
return this.write([ArduinoFirmata.END_SYSEX]);
};
ArduinoFirmata.prototype.pinMode = function(pin, mode) {

@@ -204,3 +220,6 @@ switch (mode) {

sysex_data = this.stored_input_data.slice(1, this.sysex_bytes_read);
return this.emit('sysex', sysex_command, sysex_data);
return this.emit('sysex', {
command: sysex_command,
data: sysex_data
});
} else {

@@ -207,0 +226,0 @@ this.stored_input_data[this.sysex_bytes_read] = input_data;

5

package.json
{
"name": "arduino-firmata",
"private": false,
"version": "0.1.0",
"version": "0.2.0",
"description": "Arduino Firmata implementation for Node.js",
"main": "lib/arduino-firmata.js",
"scripts": {
"test": "grunt test"
"test": "./node_modules/grunt-cli/bin/grunt test"
},

@@ -16,2 +16,3 @@ "devDependencies": {

"grunt": "*",
"grunt-cli": "*",
"grunt-simple-mocha": "*",

@@ -18,0 +19,0 @@ "grunt-notify": "*",

@@ -12,3 +12,4 @@ arduino-firmata

## Install
Install
-------

@@ -18,3 +19,5 @@ % npm install arduino-firmata

## Requirements
Requirements
------------
* Arduino (http://arduino.cc)

@@ -26,3 +29,4 @@ * testing with Arduino UNO, Leonardo and Micro.

## Usage
Usage
-----

@@ -109,12 +113,35 @@ ### Samples

### Sysex
## Test
- http://firmata.org/wiki/V2.1ProtocolDetails#Sysex_Message_Format
- https://github.com/shokai/node-arduino-firmata/tree/master/samples/sysex
% npm install
Send
```javascript
arduino.sysex(0x01, [13, 5, 2]); // command, data_array
```
connect firmata installed Arduino board, then
Register Sysex Event
```javascript
arduino.on('sysex', function(e){
console.log("command : " + e.command);
console.log(e.data);
});
```
% grunt test
Test
----
### Install SysexLedBlinkFirmata into Arduino
* https://github.com/shokai/node-arduino-firmata/blob/master/samples/sysex/StandardFirmataWithLedBlink/StandardFirmataWithLedBlink.ino
### Run Test
% npm install
% npm test
Contributing

@@ -121,0 +148,0 @@ ------------

@@ -38,2 +38,4 @@ var http = require('http');

socket.emit('analogRead', arduino.analogRead(0));
// on click button on HTML-side, change LED

@@ -40,0 +42,0 @@ socket.on('digitalWrite', function(stat) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet