Add com.pl

This commit is contained in:
sergiotarxz 2024-06-08 01:41:56 +02:00
commit be4e85205d
1 changed files with 29 additions and 0 deletions

29
com.pl Normal file
View File

@ -0,0 +1,29 @@
use Device::SerialPort;
my $port = new Device::SerialPort("/dev/ttyACM0");
$port->user_msg('ON');
$port->baudrate(9600);
$port->parity("none");
$port->databits(8);
$port->stopbits(1);
$port->handshake("xoff");
$port->write_settings;
$port->lookclear;
my $is_writting = 0;
my $i = 0;
while (1) {
my ($count, $saw) = $port->read(1);
$i++;
if ($count < 1) {
if ($is_writting) {
print "\n";
$is_writting = 0;
$i = 0;
}
next;
}
print $saw;
$is_writting = 1;
}