Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #107 from Lophilo/doc

Everything must occur after on('open')
  • Loading branch information...
commit 7a79a94e1659d5b0dc26a874664897e5aa882c60 2 parents 4b06d8d + 94d34bc
Chris Williams authored
Showing with 21 additions and 0 deletions.
  1. +21 −0
@@ -93,6 +93,27 @@ The options object allows you to pass named options to the serial port during in
**Note, we have added support for either all lowercase OR camelcase of the options (thanks @jagautier), use whichever style you prefer.**
+open event
+You MUST wait for the open event to be emitted before reading/writing to the serial port. The open happens asynchronously so installing 'data' listeners and writing
+before the open event might result in... nothing at all.
+Assuming you are connected to a serial console, you would for example:
+serialPort.on("open", function () {
+ console.log('open');
+ serialPort.on('data', function(data) {
+ console.log('data received: ' + data);
+ });
+ serialPort.write("ls\n", function(err, results) {
+ console.log('err ' + err);
+ console.log('results ' + results);
+ });
List Ports
Please sign in to comment.
Something went wrong with that request. Please try again.