DEV Community

ManaS KumaR
ManaS KumaR

Posted on

Nodemcu with johnny-five

const { EtherPortClient } = require("etherport-client")
const { Board, Led, Pin } = require("johnny-five")
const keypress = require("keypress")

const board = new Board({
port: new EtherPortClient({
host: "192.168.43.18",
port: 3030,
}),
repl: false,
})

keypress(process.stdin)
const LED_PIN = 14

board.on("ready", () => {
console.log("Board ready")
var led = new Led(LED_PIN)
console.log("Use Up and Down arrows for On and Off. Space to stop.")

process.stdin.resume()
process.stdin.setEncoding("utf8")
process.stdin.setRawMode(true)

process.stdin.on("keypress", (ch, key) => {
if (!key) {
return
}

if (key.name === "q") {
  console.log("Quitting")
  process.exit()
} else if (key.name === "up") {
  console.log("Blink")
  led.blink()
} else if (key.name === "down") {
  console.log("Stop blinking")
  led.stop()
}
Enter fullscreen mode Exit fullscreen mode

})
})

am getting bellow error

D:\manas\carrier-work\johnny-five>node index.js
1684850459534 SerialPort Connecting to host:port: 192.168.43.18:3030
1684850459536 Connected Connecting to host:port: 192.168.43.18:3030
1684850469537 Device or Firmware Error A timeout occurred while connecting to the Board.

Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting

If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.
node:events:381
throw err; // Unhandled 'error' event
^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({
type: 'error',
timestamp: 1684850469537,
class: 'Device or Firmware Error',
message: 'A timeout occurred while connecting to the Board. \n' +
'\n' +
"Please check that you've properly flashed the board with the correct firmware.\n" +
'See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting\n' +
'\n' +
"If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.",
data: null
})
at new NodeError (node:internal/errors:371:5)
at Board.emit (node:events:379:17)
at Board.log (D:\manas\carrier-work\johnny-five\node_modules\johnny-five\lib\board.js:637:8)
at Board. as error
at Timeout._onTimeout (D:\manas\carrier-work\johnny-five\node_modules\johnny-five\lib\board.js:384:14)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
code: 'ERR_UNHANDLED_ERROR',
context: {
type: 'error',
timestamp: 1684850469537,
class: 'Device or Firmware Error',
message: 'A timeout occurred while connecting to the Board. \n' +
'\n' +
"Please check that you've properly flashed the board with the correct firmware.\n" +
'See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting\n' +
'\n' +
"If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.",
data: null
}
}

Top comments (0)