Skip to content

Instantly share code, notes, and snippets.

@danopia
Created March 20, 2009 21:26
Show Gist options
  • Save danopia/82589 to your computer and use it in GitHub Desktop.
Save danopia/82589 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use Device::SerialPort;
my $port = Device::SerialPort->new("/dev/ttyUSB0");
$port->databits(8);
$port->baudrate(9600);
$port->parity("none");
$port->stopbits(1);
while (<>) {
if ($_ =~ /\((.+):danopia\): (.+)/) {
$line = sprintf("%-80s", $2);
$line = substr($line, 0, 20) . substr($line, 40, 20) . substr($line, 20, 20) . substr($line, 60, 20);
$port->write($line);
}
}
#@lines=(<>);
#$port->write(@lines);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment