const { Board, Led } = require("johnny-five"); const board = new Board(); board.on("ready", () => { const led = new Led(13); board.loop(1000, () => { led.toggle(); }); });
const { Board, Sensor } = require("johnny-five"); const board = new Board(); board.on("ready", () => { const sensor = new Sensor("A0"); board.loop(100, () => { console.log(sensor.value); }); });This code reads the analog input value from pin A0 of the Arduino board at an interval of 100 milliseconds and prints it to the console. The package library used in these examples is Johnny-Five.