From be4e85205dc5df67dce2ae4082e432870da17cf3 Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Sat, 8 Jun 2024 01:41:56 +0200 Subject: [PATCH] Add com.pl --- com.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 com.pl diff --git a/com.pl b/com.pl new file mode 100644 index 0000000..672fc61 --- /dev/null +++ b/com.pl @@ -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; +}