#!/usr/bin/env perl
use Device::SerialPort;

   my $port = Device::SerialPort->new("/dev/ttyACM0");
   $port->databits(8);    $port->baudrate(19200);
   $port->parity("none"); $port->stopbits(1);

  $cmd = "START\n";
  $port->write($cmd);
  sleep(0.5);

  $cmd = "AUTOAVG 1\n";
  $port->write($cmd);
  sleep(0.5);

  my $result = $port->input;
  print $result;

  $port->close;
  undef $port;
