[racket] Beginner: advice COM port I/O

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Dec 30 20:54:45 EST 2011

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!

Posted on the users mailing list.