nodebotsGet led api from johnny five library
This works if you are connected with arduino with flashed firmata and using johnny five library with javascript
code example
const { Board, Led } = require("johnny-five");
const board = new Board();
board.on("ready", () => {
const led = new Led(13);
board.repl.inject({
led
})
board.on('exit', () => {
led.off();
})
});
This takes you in REPL mode where you can enter led.on() and led.off() and you can check the state by entering
board.pins['13'].value
what this does is goes in the object called board and it shows you all the state from the pins and we go in pins and select [‘13’] as this is an array and that returns an object which has key value pairs, where we will grab the value key, sounds confusing but value is the key name
This is the picture of the arduino board for this code
Thankyou