17
I have to make a language communicate with the arduino
and vice versa.
I own the program at C
and I have to modify it for this project, the language I have to use is Perl
.
Follow 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");
}
}
The following serial port error is occurring:
What are your doubts and what difficulties are you facing? You could be more specific?
– gato
how to make the Cod for sensors on the Arduino send information to LP and the PL send it back to the Arduino, exchange information between them
– Mirela Vieira
at a glance here and see if it helps you.
– gato
@Mirelavieira You need to install the package
Win32::SerialPort
.– stderr
I downloaded and executed but I could
– Mirela Vieira
@Mirelavieira The same error? if yes, maybe the module has not been installed correctly. Which command did you use to install this module?
– stderr
I think now your question is legal and I voted to reopen. There is one more vote to reopen as well. 5 votes are required for the reopening (3 are missing).
– Victor Stafusa
@Mirelavieira Which command you used to install the module?
– stderr
@Mirelavieira OK. Which command did you use to install the module? something else, according to documentation, it is necessary to specify the door name (ex.: COM4) or a configuration file (ex.: COM2.cfg) of
Win32::SerialPort
.– stderr
tried some q find on the network but it may be q i n got installed, port com3
– Mirela Vieira
@Victorstafusa, I agree with you: the subject is interesting. How do I vote to reopen? (maybe I don’t have a reputation to vote...). However: (1) install perl (suggest Strawberry perl); (2) install the module (cpan Win32::Serialport); (3) try again...
– JJoao
@Jjoao The question has been reopened. If you have an answer, go ahead and post it. D
– Victor Stafusa
already posted, this already corrected! =)
– Mirela Vieira
@Mirelavieira managed to solve the problem?
– gato
@Mirelavieira vc nn should put the correct code in the question, but make an answer by answering it
– Boneco Sinforoso
@stderr Can you post your solution here as an answer? (and give a rollback on the question?) Pretty Please!
– Daniel