![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
http://www.youtube.com/watch?v=zFPpQwZqBDw
Code: Select all
#! /usr/bin/perl
# I had edited this script after I made the video, I tried to get it back the way it was, but may have missed something
use strict;
use Device::SerialPort;
use Time::HiRes;
my $file = "/dev/ttyUSB1";
my $ob = Device::SerialPort->new ($file) || die "Can't open $file: $!";
$ob->baudrate(9600) || die "fail setting baudrate";
$ob->parity("none") || die "fail setting parity";
$ob->databits(8) || die "fail setting databits";
$ob->stopbits(1) || die "fail setting stopbits";
$ob->handshake("none") || die "fail setting handshake";
$ob->write_settings || die "no settings";
my $pass;
$pass=$ob->write("lets get ready to go");
print "We are pausing for 2 seconds to get the port open\n";
sleep 2;
while (1) {
for (my $i = 1; $i < 255; $i++) {
print "the value of i is $i\n";
for (my $repeat =1;$repeat < 100; $repeat++) {
$pass=$ob->write(pack('c',$i));
Time::HiRes::sleep(.01);
}
}
print "finished this cycle, We are pausing for 3 seconds\n";
sleep 3;