[WindyCity-pm] Trapping data from the a serial port.

Richard Reina richard at rushlogistics.com
Thu Dec 20 07:58:51 PST 2007


I am trying to find a way to continuously transfer files over a serial port.  Thanks to Eric and Jonathon yesterday I learened how to send and receive files through a serial port.  Many thanks.  However, due to my inability to interpolate variables at the bash command line I decided to try:

#!/usr/bin/perl5 -w

use strict;
while(1) {

my ($yr, $mo, $day, $hr, $min, $sec) = (localtime)[5,4,3,2,1,0];
my $date = $sec . $min . $hr . $day . ($mo + 1) . ($yr + 1900);
system("cat /dev/ttyS0 > $date");

}

This does not work well because none of the files are written until the program is killed and then they seem to be empty on the receiving end.  Would it be better to make this a shell script or is perl script fixable?

Thanks for any help.

Richard


Your beliefs become your thoughts.  Your thoughts become your words.  Your words become your actions.  Your actions become your habits.  Your habits become your values.  Your values become your destiny.  -- Mahatma Gandhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/windycity-pm/attachments/20071220/ed8cbee1/attachment.html 


More information about the WindyCity-pm mailing list