Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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 0.2.0 to 0.2.1

5

History.txt

@@ -0,1 +1,6 @@

=== 0.2.1 2014-01-29
* fix servoWrite sample and README
* callback after digitalWrite, analogWrite, servoWrite, reset and sysex #11
=== 0.2.0 2014-01-28

@@ -2,0 +7,0 @@

35

lib/arduino-firmata.js

@@ -149,11 +149,12 @@ (function() {

ArduinoFirmata.prototype.reset = function() {
return this.write([ArduinoFirmata.SYSTEM_RESET]);
ArduinoFirmata.prototype.reset = function(callback) {
return this.write([ArduinoFirmata.SYSTEM_RESET], callback);
};
ArduinoFirmata.prototype.write = function(bytes) {
return this.serialport.write(bytes);
ArduinoFirmata.prototype.write = function(bytes, callback) {
return this.serialport.write(bytes, callback);
};
ArduinoFirmata.prototype.sysex = function(command, data) {
ArduinoFirmata.prototype.sysex = function(command, data, callback) {
var write_data;
if (data == null) {

@@ -165,8 +166,7 @@ data = [];

});
this.write([ArduinoFirmata.START_SYSEX, command]);
this.write(data);
return this.write([ArduinoFirmata.END_SYSEX]);
write_data = [ArduinoFirmata.START_SYSEX, command].concat(data, [ArduinoFirmata.END_SYSEX]);
return this.write(write_data, callback);
};
ArduinoFirmata.prototype.pinMode = function(pin, mode) {
ArduinoFirmata.prototype.pinMode = function(pin, mode, callback) {
switch (mode) {

@@ -179,6 +179,6 @@ case true:

}
return this.write([ArduinoFirmata.SET_PIN_MODE, pin, mode]);
return this.write([ArduinoFirmata.SET_PIN_MODE, pin, mode], callback);
};
ArduinoFirmata.prototype.digitalWrite = function(pin, value) {
ArduinoFirmata.prototype.digitalWrite = function(pin, value, callback) {
var port_num;

@@ -192,14 +192,15 @@ this.pinMode(pin, ArduinoFirmata.OUTPUT);

}
return this.write([ArduinoFirmata.DIGITAL_MESSAGE | port_num, this.digital_output_data[port_num] & 0x7F, this.digital_output_data[port_num] >>> 7]);
return this.write([ArduinoFirmata.DIGITAL_MESSAGE | port_num, this.digital_output_data[port_num] & 0x7F, this.digital_output_data[port_num] >>> 7], callback);
};
ArduinoFirmata.prototype.analogWrite = function(pin, value) {
ArduinoFirmata.prototype.analogWrite = function(pin, value, callback) {
value = Math.floor(value);
this.pinMode(pin, ArduinoFirmata.PWM);
return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), value & 0x7F, value >>> 7]);
return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), value & 0x7F, value >>> 7], callback);
};
ArduinoFirmata.prototype.servoWrite = function(pin, angle) {
this.pinMode(pin, ArduinoFirmata.SERVO);
return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), angle & 0x7F, angle >>> 7]);
ArduinoFirmata.prototype.servoWrite = function(pin, angle, callback) {
var _this = this;
this.pinMode(pin, ArduinoFirmata.SERVO, function(err, res) {});
return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), angle & 0x7F, angle >>> 7], callback);
};

@@ -206,0 +207,0 @@

{
"name": "arduino-firmata",
"private": false,
"version": "0.2.0",
"version": "0.2.1",
"description": "Arduino Firmata implementation for Node.js",

@@ -6,0 +6,0 @@ "main": "lib/arduino-firmata.js",

@@ -52,2 +52,6 @@ arduino-firmata

Reset
```javascript
arduino.reset(callback);
```

@@ -64,4 +68,4 @@ Close

```javascript
arduino.digitalWrite(13, true);
arduino.digitalWrite(13, false);
arduino.digitalWrite(13, true, callback);
arduino.digitalWrite(13, false, callback);
```

@@ -87,4 +91,4 @@

setInterval(function(){
var an = Math.random()*255;
arduino.analogWrite(9, an);
var an = Math.random()*255; // 0 ~ 255
arduino.analogWrite(9, an, callback);
}, 100);

@@ -108,4 +112,4 @@ ```

setInterval(function(){
var angle = Math.random()*180;
arduino.analogWrite(11, angle);
var angle = Math.random()*180; // 0 ~ 180
arduino.servoWrite(11, angle, callback);
}, 1000);

@@ -121,3 +125,3 @@ ```

```javascript
arduino.sysex(0x01, [13, 5, 2]); // command, data_array
arduino.sysex(0x01, [13, 5, 2], callback); // command, data_array, callback
```

@@ -124,0 +128,0 @@

@@ -13,4 +13,4 @@ var ArduinoFirmata = require(__dirname+'/../');

console.log("servo write 9 pin : " + angle);
arduino.analogWrite(9, angle);
arduino.servoWrite(9, angle);
}, 1000);
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc