[R-SIG-Mac] USB I/O via R
Atul Sharma
atul.sharma at mcgill.ca
Sat Jan 24 03:01:43 CET 2009
I have an ongoing need to read a real-time data stream via the USB
port on a MacBook Pro (OS 10.5.6). I have several different hardware
sources, including commercial rs-232 instruments and a number of
microcontrollers, such as the Atmega168 or Hitachi H8, but my
question is generic to any serial I/O device, I think. To date, I have
been content to interact with the microcontroller via terminal.app,
where the 'screen' function allows me to exchange data with the card
and to capture the incoming ASCII text stream to disk. From within R,
this ASCII data file is then read and processed.
Since it is independent of the R read.table() command, I'm sure it
has to do with the details of the 'screen' implementatation or OS time-
sharing. The problem is that the data appears to be written to disk at
irregular intervals, and it lags what is actually being received/
displayed by 2-3 seconds. While this has not been a problem to date, I
will soon need more "real time" access to the serial port, and I was
wondering if there was a way to access it directly from within R i.e.
a serial port communications library for R. Simple ASCII text read-
write is all I require. I have not had any luck with attempts to
search this group and google for "serial", "rs-232", "usb"," i/o"
etc, but I was wondering if any one has any experience they'd be
willing to share with inputting serial port data directly into R on
the Mac?
A. Sharma
Montreal, QC
More information about the R-SIG-Mac
mailing list