[racket] Beginner: advice COM port I/O

From: Gilbert Martinez (gil.martinez242 at gmail.com)
Date: Sat Dec 31 13:34:37 EST 2011

Thanks, Eli.  I completely misread the documentation and incorrectly
assumed that Windows converted LF to CRLF when writing to the port (turns
out this is not the case for 'binary mode).

I've incorporated the flush-output expression and made a note to get heavy
on format string syntax.


On Fri, Dec 30, 2011 at 7:54 PM, Eli Barzilay <eli at barzilay.org> wrote:

> 20 minutes ago, Gilbert Martinez wrote:
> > Thanks for the advice; consistent with your recommendations and those of
> Mr.
> > Cleis, I will re-implement this using write-bytes rather attempting to
> display
> > a string.
> >
> > My working VB code required the carriage-return linefeed character in
> order to
> > work properly ( .WriteLine("V00" & vbCrLf) ).  I'll attempt various line
> > terminations and, failing all else, I'll check the pins with a
> scopemeter to
> > see the characters transmitted and go from there.
> Your original code didn't have a CRLF -- both `displayln' and the "~n"
> format strings show only an LF (even though you've used the latter to
> show the input).  To display CRLF, you need to write that explicitly:
>  (fprintf out "V00\r\n")
> Also, it's a good idea to start using (flush-output out) to avoid
> surprises in the future.
> And BTW, "\t" is a tab -- you don't need to use `#\tab'...
> --
>          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                    http://barzilay.org/                   Maze is Life!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20111231/7e00a909/attachment.html>

Posted on the users mailing list.