I have to make a language communicate with arduino
and vice versa.
I have the program in C
and I have to modify it for this project, the language I will have to use is Perl
.
Here is the code I have:
use 5.014;
use strict;
use warnings;
use Win32::SerialPort;
my $port = new Win32::SerialPort("lib/Win32/SerialPort.pm");
$port->user_msg(ON);
$port->databits(8);
$port->baudrate(19200);
$port->parity("none");
$port->stopbits(1);
$port->dtr_active(0);
while (1) {
print "Enter a number... ";
my $char = ;
chomp($char);
# Send the character to the Arduino
if ($char =~ /^\d+$/) {
print "Sending $char ...\n";
$port->write("$char");
}
}
You are giving the following error on the serial port: