Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

I'm trying to bypass Bridge library and read serial directly from nodejs. I'm on the last sys upgrade (1.3) I have correctly installed nodes and serial module via opkg install. I have also commented out the line in the /etc/inittab:

#ttyATH0::askfirst:/bin/ash --login

This is my arduino code:

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("dudee");
  delay(100);
}

This is my node.js code:

var SerialPort = require("serialport").SerialPort
var serialPort = new SerialPort("/dev/ttyATH0", {
    baudrate: 9600,
    dataBits: 8,
    parity: 'none',
    stopBits: 1,
    flowControl: false
}, false);

console.log("hello");

serialPort.on("open", function () {
    console.log('open');
    serialPort.on('data', function(data) {
        console.log('data received: ' + data);
    });
});

serialPort.on('error', function(err) {
    console.log('error: '+err);
});

serialPort.open();

If I ssh to yun and run the script I don't see any "dudee":

~/test# node serial.js
hello
open

While if I open the serial monitor I see it.

If I run the node script on my computer (changing the right serial port name) everything works nice and I see the dude..

What can it be?

share|improve this question

1 Answer 1

Autosolved thanks to this old forum post.

It is Serial1 not Serial.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.