#!/usr/bin/perl use warnings; use strict; use Device::SerialPort; my $port = Device::SerialPort->new( "/dev/ttyUSB0" ); $port->baudrate(57600); $port->databits(8); $port->stopbits(1); $port->parity("none"); my $bytestring =""; my $status =0; while(1) { my $byte=$port->read(1); if ($byte =~ /L/) { $bytestring=""; $status=1; } if ($status==1) { $bytestring=$bytestring.$byte; } if ($byte =~ /;/) { my @data = split(/=/, $bytestring); if ($data[0] =~ /L/) { if (scalar(@data)>3) { } else { if (($data[scalar(@data)-1]=~ /20/)) { print "Check Okay"; } } } $status=0; } else { print "Failure"; open (FILE, '>statusrf12.txt'); print FILE "0"; close FILE; } sleep(3); }