Question

I am trying to run the following nodejs code, based on the duino module found here: https://github.com/ecto/duino

bleep.js:

var arduino = require("duino");
var board = new arduino.Board();

var led = new arduino.Led({
  board: board,
  pin: 13
});

var bleep = function() {
  led.on();
  setTimeout(function() {
    led.off();
  }, 100);
}
setInterval( bleep, 1000 );

EDIT
Based on zmo's suggestion, I am now running du.ino (found under duino/src/) on my arduino board and bleep.js on my laptop.

Whilst compiling bleep.js, I get the following error: Error: Cannot open /dev/

I was trying to trace back to where the path is being set. I have traced this error to duino/node_modules/serialport/serialport.js

May I know how the following line (found in serialport.js) works?

function SerialPort(path, options, openImmediately, callback) {

Before this function is called on line 49, the 'path' variable is [object Object].
But after, it becomes /dev/

where does the change take place?

Thank you.

Was it helpful?

Solution

uhuh... where to start.

It looks like you're trying to compile your js code as an arduino sketch .ino files using the arduino ide. That can't work, it should be C++ code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top