Show Posts
Pages: [1]
1  Using Arduino / Interfacing w/ Software on the Computer / Arduino UNO serial port and Perl on: October 04, 2012, 05:28:31 am
Hello.

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(smiley-cool; # but not this and the two following
$port->parity("none");
$port->stopbits(1);
Pages: [1]