There's also this fork of node-serialport that appears to attempt to add some COM-specific functionality to node-serialport: https://github.com/jaredhanson/node-serialport/compare/windows-support
On Friday, April 6, 2012 3:36:28 PM UTC-7, Bert Belder wrote: > > On Apr 6, 9:56 pm, KentK <[email protected]> wrote: > > Hi I am running this on Windows 7. > > I am trying to set up a dual communication towards an external serial > > device on COM1. > > What happens is that I will only receive (fs.read) the first incoming > > character. > > Before I receive that character I am not able to send any character, > > but after receiving, I can send over and over again. But not receive > > any more. > > > > Here is the code: > > > > var fs = require('fs'); > > var fd; > > > > var Buffer = require('buffer').Buffer; > > var buffer = new Buffer(100); > > > > fs.open("\\\\.\\COM1", "w+", function(status, _fd){ > > fd = _fd; > > if(status){ > > console.log(status.message); > > return; > > } > > > > fs.read(fd, buffer, 0, 100, null, function(e,l,b){ > > console.log("Read " + l + " bytes."); > > return; > > }); > > > > }); > > > > var buf = new Buffer('BBBB\n'); > > var stdin = process.openStdin(); > > stdin.on('data', function(chunk) { > > // For now I just send the four Bs when [Enter] is pressed. > > fs.write(fd, buf, 0, buf.length, null, function(err,written){ > > if(err)throw err; > > console.log(written + " characters written."); > > }); > > }); > > Well, you're only doing one reading attempt, so it doesn't surprise me > that you don't receive more than one chunk of data. > > However I should warn you - nobody ever tested COM ports with node for > windows (at least not that I am aware of) so it might not work at all. > If you hit a snag, you can ask here, but I guess you'd better just > debug node and figure out what's going wrong yourself. > > - Bert -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
