title: nodejs - reading from the serial port
body: <p>I've been looking around for an answer on this...</p>
  
  <p>Basically, I want to read data from the serial port (in this case, over USB). I've looked into the node-serialport module but it keeps stalling after the first result form the serial port. I expected it to just spit out the data when it received it. It's as if a buffer is filling up and needs to be flushed somehow?</p>
  
  <p>I've slightly modified the code from the demos I found here - <a href="https://github.com/voodootikigod/node-serialport/tree/master/tests" rel="noreferrer">https://github.com/voodootikigod/node-serialport/tree/master/tests</a></p>
  
  <p>Here's my code:</p>
  
  <pre><code>    var sys = require("sys"),
      repl = require("repl"),
      serialPort = require("serialport").SerialPort;
  
      // Create new serialport pointer
      var serial = new serialPort("/dev/tty.usbmodem1d11" , { baudrate : 9600 });
  
      // Add data read event listener
      serial.on( "data", function( chunk ) {
          sys.puts(chunk);
      });
  
  
      serial.on( "error", function( msg ) {
          sys.puts("error: " + msg );
      });
  
      repl.start( "=&gt;" );
  </code></pre>
  
  <p>I'm using an Arduino hence the 9600 baudrate.</p>
  
  <p>Any help would be awesome, cheers,</p>
  
  <p>James</p>