UPDATED QUESTION: So basically I would like to view live input from the Arduino via Perl and send input to the Arduino via Serial. Hello Group! I can successfully send a command to the serial device and I can see the response when a button is pressed on the device however I would like to see it in real time and not when I hit the enter button again. Thanks in advanced my code is below:
use Win32::SerialPort; my $port = Win32::SerialPort->new("COM16") or die "Open Port Failed. $ +!\n"; $port->is_rs232; $port->initialize(); $port->baudrate(9600); $port->databits(8); $port->parity("none"); $port->stopbits(1); $port->write_settings || undef $port; sleep(3); print "STARTING RELAY SIGNAL PROGRAM\n\n"; while (1) { print "ENTER A SIGNAL COLOR... "; my $char = <STDIN>; $char = <STDIN> until defined $char; chomp($char); # SEND THE COMMAND TO THE ARDUINO if ($char =~ /^\d+$/) { print "\nSENDING $char ...\n\n"; $port->write("$char\r"); } $port->lookclear(); my $data = $port->lookfor; if ($data =~ /BONE/) { print "\nBUTTON PRESSED\n\n"; } $port->lookclear(); $port->purge_all; } # END WHILE LOOP

In reply to Win32 Serial Read input from device by PilotinControl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.