@sdiricco/boardjs
v0.2.7
Published
Implementation of firmatajs library based on Promise syntax with helpful extra functions.
Downloads
2
Readme
boardjs
Implementation of firmatajs library based on Promise syntax with helpful extra functions.
Installation
Upload StandardFirmata.ino to your Arduino board using Arduino IDE.
Install the library:
npm i @sdiricco/boardjs
Compilation problems
Firmata use Node SerialPort to communicate with the usb boards and sometimes you may run into compilation problems. See SerialPort - Compilation Problems
Basic Usage
Connect the board with a valid StandardFirmata.ino and run following script.
const { Board } = require("@sdiricco/boardjs");
let main = async () => {
try {
const board = new Board();
board.on("error", (e) => {
console.log(e);
});
console.log("connecting.. ");
await board.connect();
console.log("board connected:", board.connected);
console.log("pinMode()");
await board.pinMode(13, board.MODES.OUTPUT);
console.log("digitalWrite()");
await board.digitalWrite(13, board.HIGH)
const pin13 = board.pins[13].value;
console.log(pin13)
} catch (e) {
console.log(e);
}
process.exit();
};
main();