Thread Device::SerialPort <--> Win32::SerialPort (13 answers)
Opened by foobar12345 at 2017-07-09 14:03

foobar12345
 2017-07-09 19:42
#186820 #186820
User since
2011-07-20
20 Artikel
BenutzerIn
[default_avatar]
muss ja irgendwie ...
so funktioniert es

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env perl
use strict;
use warnings;
use Win32::SerialPort;

$|=1;

my $serDev = $ARGV[0] || 'COM3';
my $serSpeed = $ARGV[1] || 115200;
my $serDB = $ARGV[2] || 8;
my $serPA = $ARGV[3] || 'none';
my $serSB = $ARGV[4] || 1;

my $port = new Win32::SerialPort($serDev);
$port->databits($serDB);
$port->baudrate($serSpeed);
$port->parity($serPA);
$port->stopbits($serSB);
$port->write_settings || undef $port;

unless ($port) {
print "Serial port: $serDev not found, use\n\n";
print " $0 <device> <speed> <baud> <parity> <stopbits>\n\n";
print " $0 /dev/ttyACM0 115200 8 none 1\n\n";
exit;
}

$port->write("PAGE\n");
sleep(3);
$port->write("PAGE\n");

View full thread Device::SerialPort <--> Win32::SerialPort