Go Down

Topic: Arduino doesn't listen to data sent via virtual serial port until Serial Monitor (Read 1 time) previous topic - next topic

m0nk3y

My problem was that I was not saving the serial port settings in my Perl script. I did indeed find this suggestion in an older thread after doing an exhaustive search (http://arduino.cc/forum/index.php/topic,21051.0.html). It was on the last page of search results, which I don't think I got up to the first time I searched the forums for a solution. Thanks for the suggestion PaulS and kicking my butt into gear to search for longer.

Here is my short Perl test script that works without having to open Serial Monitor/PuTTY:

Code: [Select]

#!perl -w

use Win32::SerialPort;
use strict;
use warnings;

$| = 1; #enable autoflush

my $PortName = "COM4";
my $sendData = "o";

### SERIAL PORT SETUP ###
my $PortObj = new Win32::SerialPort($PortName) or die "Can't open $PortName: $^E\n";
$PortObj->baudrate(57600);
$PortObj->parity("none");
$PortObj->databits(8);
$PortObj->stopbits(1);
$PortObj->write_settings(); #very important!

$PortObj->write($sendData);

$PortObj->close() || warn "\nClose failed\n";


Hopefully this will be of use to someone - maybe me in a few years time when I forget what I did.

Go Up