#!/usr/bin/perl -w
###########################################
# mmread - Read a meter value via RS-232
# Mike Schilli, 2007 (m@perlmeister.com)
# Joachim Franek 2009 for UNI-T UT70D
###########################################
use strict;
use Device::SerialPort;

my $serial = Device::SerialPort->new("/dev/ttyUSB0");

$serial->baudrate(9600);
$serial->databits(8);
$serial->parity("none");
$serial->stopbits(1);
$serial->purge_all();
$serial->rts_active(0);
$serial->dtr_active(1);

   # Wait one second, jf: rts braucht wohl einen Moment!
select(undef, undef, undef, 1);
   # Send request
$serial->write(chr(137));
   # Wait one second
select(undef, undef, undef, 1);

   # Read response
my($count, $data) = $serial->read(12);
print "$count $data\n";


