[racket] Beginner: advice COM port I/O

From: Gilbert Martinez (gil.martinez242 at gmail.com)
Date: Fri Dec 30 16:59:28 EST 2011

I've been experimenting with Racket v5.2 and a GW Instek 8212 meter
connected to my PC via COM1 (running WinXP SP3).

The meter responds to simple commands (e.g., "V00"  terminated with a line
feed is read voltage) and I've written simple programs in Python, VB, and
even QuickBasic  to query the device.

However, I've had no success in getting the device to respond from inside
the Racket REPL.

I've pasted the code I'm using below:

#lang racket

    (((in out) (open-input-output-file "COM1"  #:mode 'binary)))

  (displayln "V00" out)
  (printf "~C~a~n" #\tab (read-bytes 1 in))
  (close-input-port in)
  (close-output-port out))

Running from the interpreter just gives me the output below:


A tester in-line with the serial cable shows I am actually writing to the
port (I see a square-wave signal), so I know that I am at least writing to
the port.

Any hints or pointers would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20111230/0f574171/attachment.html>

Posted on the users mailing list.