Skip to content

Instantly share code, notes, and snippets.

@jsleeio
Created July 25, 2013 10:38
Show Gist options
  • Save jsleeio/6078594 to your computer and use it in GitHub Desktop.
Save jsleeio/6078594 to your computer and use it in GitHub Desktop.
Requires Device::SerialPort module from CPAN
#!/usr/bin/perl -w
use strict;
use warnings;
use Device::SerialPort;
my $file = "/dev/tty.usbserial-A700fbpg";
my $ob = Device::SerialPort->new ($file) || die "Can't open $file: $!";
$ob->baudrate(9600) || die "fail setting baudrate";
$ob->parity("none") || die "fail setting parity";
$ob->databits(8) || die "fail setting databits";
$ob->stopbits(1) || die "fail setting stopbits";
$ob->handshake("none") || die "fail setting handshake";
$ob->write_settings || die "no settings";
$ob->error_msg(1); # use built-in error messages
$ob->user_msg(1);
while(1) {
$ob->write("p");
print $ob->input;
sleep 5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment