Created
April 3, 2013 20:06
-
-
Save divanvisagie/5304750 to your computer and use it in GitHub Desktop.
Tests for serialport on node v0.10.x , the outputs are the same for both v0.8.21 and v0.10.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data received: Th | |
| data received: is i | |
| data received: s so | |
| data received: me s | |
| data received: eria | |
| data received: l da | |
| data received: ta | |
| data received: T | |
| data received: his | |
| data received: is s | |
| data received: ome | |
| data received: seri | |
| data received: al d | |
| data received: ata | |
| data received: | |
| data received: This | |
| data received: is | |
| data received: some | |
| data received: ser | |
| data received: ial | |
| data received: data | |
| data received: | |
| data received: Thi | |
| data received: s is | |
| data received: som | |
| data received: e se | |
| data received: rial | |
| data received: dat | |
| data received: a | |
| data received: Th | |
| data received: is i | |
| data received: s so | |
| data received: me s | |
| data received: eria | |
| data received: l d | |
| data received: ata | |
| data received: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var serialport = require( 'serialport' ); | |
| var SerialPort = serialport.SerialPort; | |
| var sp = new SerialPort( '/dev/cu.usbmodemfa1331', { | |
| baudrate : 9600 | |
| } ); | |
| sp.on('data', function(data) { | |
| console.log('data received: ' + data); | |
| }); | |
| sp.write("ls\n", function(err, results) { | |
| console.log('err ' + err); | |
| console.log('results ' + results); | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup(){ | |
| Serial.begin( 9600 ); | |
| } | |
| void loop(){ | |
| Serial.println( "This is some serial data" ); | |
| delay( 1000 ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment