[racket] How do I set baud/parity/stop for a serial port?

From: Steven Zins (stevenzins at gmail.com)
Date: Sun Aug 21 23:53:50 EDT 2011

How do I set baud/parity/stop in Racket for a serial port in
Windows/Linux/Mac. Eg for "\\.\COM4"

(new button% [parent ButtonPanel] [label "Test USB"]
     [callback
      (lambda (e b)
        (let-values
            ([(in-com out-com)
              (open-input-output-file
               "\\\\.\\COM4" #:mode 'binary #:exists 'append) ])
          (displayln (list "open-input-output-file"  in-com out-com))
          (displayln (write-string " cold \\r " out-com))
          ))])
The above seems to work. It blows up iff COM4 is absent. It prints
(open-input-output-file #<input-port:\\.\COM4> #<output-port:\\.\COM4>)
9
iff COM4 is present. But receiving device apparently gets nothing.

Thanks,
Steve
--------------------------------
Steven Zins
575-621-0950
LEDybug.com
Las Cruces, NM USA
--------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110821/6f599e07/attachment.html>

Posted on the users mailing list.