
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
arduino-firmata
Advanced tools
Arduino Firmata protocol (http://firmata.org) implementation on Node.js.
% npm install arduino-firmata
Connect
var ArduinoFirmata = require('arduino-firmata');
var arduino = new ArduinoFirmata();
arduino.connect(); // use default arduino
arduino.connect('/dev/tty.usb-device-name');
arduino.on('connect', function(){
console.log("board version"+arduino.boardVersion);
// your-code-here
});
Reset
arduino.reset(callback);
Close
arduino.close(callback);
Digital Write
arduino.digitalWrite(13, true, callback);
arduino.digitalWrite(13, false, callback);
Digital Read
arduino.pinMode(7, ArduinoFirmata.INPUT);
console.log( arduino.digitalRead(7) ); // => true/false
Digital Read (event)
arduino.pinMode(7, ArduinoFirmata.INPUT);
arduino.on('digitalChange', function(e){
console.log("pin" + e.pin + " : " + e.old_value + " -> " + e.value);
});
Analog Write (PWM)
setInterval(function(){
var an = Math.random()*255; // 0 ~ 255
arduino.analogWrite(9, an, callback);
}, 100);
Analog Read
console.log( arduino.analogRead(0) ); // => 0 ~ 1023
Analog Read (event)
arduino.on('analogChange', function(e){
console.log("pin" + e.pin + " : " + e.old_value + " -> " + e.value);
});
Servo Motor
setInterval(function(){
var angle = Math.random()*180; // 0 ~ 180
arduino.servoWrite(11, angle, callback);
}, 1000);
Send
arduino.sysex(0x01, [13, 5, 2], callback); // command, data_array, callback
Register Sysex Event
arduino.on('sysex', function(e){
console.log("command : " + e.command);
console.log(e.data);
});
% npm install
% npm run build
# or
% npm run watch
% npm test
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Arduino Firmata implementation for Node.js
The npm package arduino-firmata receives a total of 49 weekly downloads. As such, arduino-firmata popularity was classified as not popular.
We found that arduino-firmata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.