Personal tools

BuZz/Stitch ledbar perlscript

From Eth0Wiki

Jump to: navigation, search
#!/usr/bin/perl

use Device::SerialPort;
use Time::HiRes qw(usleep);

$port = Device::SerialPort->new("/dev/ttyUSB0");
if (!$port) { 
	print "ttyUSB0 unopenable\n";
	exit;
}

$port->databits(8);
$port->baudrate(9600);
$port->parity("none");
$port->stopbits(1);

# my $text = "<D*>";   # dit is alles wissen
my $text = "<PA><CA>--<CB>=<CC>[<CM> 21:30-22:30 get drunk on the cheap, hacky hour; 1 grolsch = just 3 tokens <CC>]<CB>=<CA>--  ";  # leuk regeltje tekst

my $command = "<ID01>".$text.chr(13).chr(10);

my $count_out = $port->write($command);