#!/usr/bin/perl

use strict;
use warnings;
use Device::MAS345;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($DEBUG);

my $mas = Device::MAS345->new( port => "/dev/ttyS0" );

while(1) {
    my($val, $unit, $mode) = $mas->read();
    die $mas->error() unless $mode;
    print "val=$val unit=$unit mode=$mode\n";
}

__END__

=head1 NAME

    masloop - Test utilty for Device::MAS345

=head1 SYNOPSIS

    $ masloop

=head1 DESCRIPTION

C<masloop> reads data from a Mastech MAS-345 multimeter connected
to the computer's serial interface in an endless loop.

=head1 LEGALESE

Copyright 2007 by Mike Schilli, all rights reserved.
This program is free software, you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 AUTHOR

2007, Mike Schilli <cpan@perlmeister.com>
