nodejs serialport write issues?

I am using the nodejs serialport module ( and I am having issues when I write to the serial port.

If I simply write to the port as shown below, the serial device never gets the command.

var serialport = require("serialport");
var sp = new serialport.SerialPort(serialPortPath);

However, if I use a setTimeout as shown below, then it seems to work?

var serialport = require("serialport");
var sp = new serialport.SerialPort(serialPortPath);

FYI, the “serialPortPath” is set elsewhere in the code.

I am not sure what is going on… any ideas?

Nodejs serialport data.toString() Failing encoding

I’ve got a barcode scanner hooked up to a raspberry pi running nodejs serialport. The serialport instance is listening to /dev/input/event0 When I run this var serialport = require(serialport); var

Difference between SerialPort.Write() and SerialPort.WriteLine()?

I looked at the SerialPort.Write() and SerialPort.WriteLine() methods on msdn and tried them on a simple code such as the ones below but they seem very similar to me. Can someone please explain what

SerialPort Class issues

I am having a lot of issues trying to get a serial port to receive the correct message. It keeps truncating the messages. Here is my code and I will try to elaborate after the code. public SerialComms

SerialPort.Write() – How to stop writing?

I am developing in C# using the SerialPort class. SerialPort.Write() is a blocking method. How can I exit this method when I want to stop writing? I use a thread to write. I abort this thread when I w

NodeJS using node-serialport sometimes becomes unresponsive

I’m using NodeJS to connect a barcode scanner to a web front-end. The barcode scanner’s serial port runs to the PC (Windows7 pro x64) through a usb-to-serial converter. I’m using node-serialport. This

nodejs serialport module or bluetooth-serial-port module, which one?

I have a couple of nodejs examples for serial communication. One example is using the serialport module (below). I have a paired bluetooth device which is set up as rfcomm0. I can communicate with it

What is the purpose of the SerialPort write buffer?

From outside SerialPort object, it seems to make no difference what the size of the write buffer is, and whether or not it is full. Using synchronous writing, the write method blocks until all the dat

Textbox and serialPort.Write() not work in C#

I have an application that writes data to a serial port and something strange is happening. If I write it directly follows it works: SerialPort.Write (at/r/n); If I get the code from a textbox, it

Serialport read write in java

I have an application where i need to write some data to the serial port and get the response from it. Now the sequence is as follows: Send a message to the serial port. wait for the response Once th

nodejs socket write ordering

When writing a nodejs proxy server I noticed that data may come into my proxy many times before the data is written to the other socket end. each time my data comes in, i call socket.write(); … Howe


I think I got it figured out from the github ( page… basically it looks like I was missing the “open” event as shown below:

serialPort.on("open", function () {
  serialPort.on("data", function(data) {
    console.log("data received: " + data);
  serialPort.write("SYST:ADDR?/n", function(err, results) {
    console.log("err: " + err);
    console.log("results: " + results);