Skip to content

Instantly share code, notes, and snippets.

@raster
Created January 19, 2011 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raster/786554 to your computer and use it in GitHub Desktop.
Save raster/786554 to your computer and use it in GitHub Desktop.
Send data to the serial port
#!/usr/bin/perl
#
# See also: http://rasterweb.net/raster/2011/01/17/perl-arduino-shiftbrite/
#
use Device::SerialPort;
my $port = Device::SerialPort->new("/dev/tty.usbmodem1d21"); # ymmv here...
$port->databits(8);
$port->baudrate(9600);
$port->parity("none");
$port->stopbits(1);
sleep(3);
for ($i = 0; $i <= 9; $i++) {
print $i . "\n";
$port->write("$i");
sleep(1);
}
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment