in reply to Re: Connecting to a USB Serial Device on Windows
in thread Connecting to a USB Serial Device on Windows
And it all works. I am able to communicate to my usb device, passing it commands and seeing the returning answer. Wahoo!#!perl use strict; #http://search.cpan.org/~cosimo/Device-Modem-1.51/ use Device::Modem; my $port="COM9"; my $modem = new Device::Modem( port =>$port ); if($modem->connect( baudrate => 115200,databits=>8,parity=>'none',stop +bits=>1 ) ) { print "connected!\n"; } else{ print "Error: Unable to connect with $port!.\n\t$!\n"; exit; } print "CMD->"; while(1){ my $cmd=<STDIN>; if($cmd=~/^(x|q|exit|quit)$/is){last;} $cmd =~s/[\r\n\t\s]+$//; $cmd =~s/^[\r\n\t\s]+//; $modem->atsend($cmd . Device::Modem::CR); print $modem->answer(); } #disconnect from the Modem $modem->disconnect(); print "\nDONE\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Connecting to a USB Serial Device on Windows
by GrandFather (Saint) on Jul 10, 2009 at 22:19 UTC | |
|
Re^3: Connecting to a USB Serial Device on Windows
by Anonymous Monk on Nov 26, 2016 at 00:46 UTC | |
|
Re^3: Connecting to a USB Serial Device on Windows
by Anonymous Monk on Jul 13, 2009 at 19:56 UTC |