Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: transferring \n to linux from perl via serial port

by haukex (Archbishop)
on Nov 29, 2020 at 11:36 UTC ( [id://11124354]=note: print w/replies, xml ) Need Help??


in reply to transferring \n to linux from perl via serial port

from a Windows laptop running Perl via serial port

Because this is Windows, the default :crlf PerlIO layer is converting your "ls\n" into "ls\x0D\x0A" (i.e., CRLF), which might be the source of your issues. Try binmode PORT; after your open to see if that helps. If it doesn't help, you'll have to check the specifications of the serial protocol for what is expected.

By the way, Use strict and warnings, and see also "open" Best Practices in regards to using three-agrument open and lexical filehandles.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11124354]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found