stoerti has asked for the wisdom of the Perl Monks concerning the following question:
I get an answer as expected:1. cat /dev/ttyUSB0& 2. stty -F /dev/ttyUSB0 300 -parodd cs7 -cstopb parenb -ixoff -crtscts + -hupcl -ixon -opost -onlcr -isig -icanon -iexten -echo -echoe -echoc +tl -echoke 3. echo -n -e '\x2F\x3F\x21\x0D\x0A' > /dev/ttyUSB0 4. echo -n -e '\x06\x30\x30\x30\x0D\x0A' > /dev/ttyUSB0
/LOG4LK13BD202015 C.1.0(06091772) 0.0.0(001LOG0006091772) F.F(0000) 1.8.0(021183.342*kWh) C.7.1(00000000) C.7.2(00000001) C.7.3(00000002) 0.2.1(ver.02, 150228, 671A) C.2.1(1510121019) C.2.9(1510121019)
gives me:open( com, "+<","/dev/ttyUSB0" ) || die "Cannot open serial port : +$!\n"; my $raw = "\x2F\x3F\x21\x0D\x0A"; print com $raw; my $raw = "\x06\x30\x30\x30\x0D\x0A"; print com $raw; while( 1 ) { my $in = <com>; print "$in\n"; }
Finish!/?! 000 /LOG4LK13BD202015
2019-05-28 Athanasius added code tags
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: r/w attached infrared head on /dev/ttyUSB0
by haukex (Archbishop) on May 25, 2019 at 16:27 UTC | |
by stoerti (Novice) on May 25, 2019 at 22:17 UTC | |
by haukex (Archbishop) on May 25, 2019 at 23:59 UTC | |
by stoerti (Novice) on May 26, 2019 at 07:36 UTC | |
by haukex (Archbishop) on May 26, 2019 at 09:24 UTC | |
| |
by huck (Prior) on May 30, 2019 at 04:25 UTC | |
| |
by huck (Prior) on May 25, 2019 at 23:31 UTC | |
by haukex (Archbishop) on May 26, 2019 at 00:01 UTC | |
by huck (Prior) on May 26, 2019 at 01:02 UTC |