Go Down

Topic: Arduino UNO serial port and Perl (Read 1 time) previous topic - next topic



I am pretty new with arudino and i have a problem with my Perl scripts and Arduino UNO r3.

I have made a code to my arduino which switch off or on Arduino board led1 if i send number 0 or 1 to it via serialport.
That code also send information about that is led on or off via serial port back to computer.

I have also referenced from internet a simple perl script which send number 1 to arduino, wait and send number 0, and looping this.
That script also read information from serial port about that is led on or off.

This all works fine if i first open my arduino IDE serial monitor and after that i close it. Then serial port opens in arduino and everything works.
But if i instantly after plugging USB cable to my arduino run my perl script serial trffic dosnt work.

I´m running Windows 7 and WIN32::SerialPort class. I do open serial port in perl something like this:

Note this code isnt my own.

use Win32::SerialPort;
my $port = Win32::SerialPort->new("COM7");
# 19200, 81N on the USB ftdi driver
$port->baudrate(9600); # you may change this value
$port->databits(8); # but not this and the two following


It could happen that plugging the USB cause the allocation of a new COM instance, under Windows. 
If so, you have to check what COM is using Arduino, once plugged, rather than forcing your choice ("COM7") before connection.
I'm also a newbie, but I hope this could help you. In any case, wait also for more expert suggestions! :)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131