[R] Wiring or Arduino package/scripts

Warren Young warren at etr-usa.com
Wed Jun 3 18:04:50 CEST 2009


Jorge Cornejo wrote:
> Hi, I am  looking any way to communicant with Arduino
> (http://www.arduino.cc/) Wiring (http://www.wiring.org.co) boards and
> read data generate with sensor on these.

On Linux you can simply open the file /dev/ttyS0 in read/write mode to 
talk on the first serial port on the PC.  (ttyS1 for the second port, 
etc.)

If your PC doesn't have serial ports, you can get a cheap USB to serial 
adapter, most of which are based on common chips like the PL2303, which 
will also work, though with a different /dev node, ttyUSB0 or something 
like that.  Type "dmesg | tail" after plugging the adapter in to see 
what /dev/ node it was assigned.

Avoid the expensive adapters.  They often use special chips, requiring 
drivers that aren't built into the OS.  The cheaper ones are actually 
better, because the chances are better that they're using some generic 
chip which your OS already knows how to talk to.

All of that also applies to Mac OS X and other Unixy type systems.

If you're on Windows, you may be screwed.  But, you can always install 
Linux on another partition, or in a virtual machine system. :)

It doesn't appear that R has a built-in way to control the bit rate and 
such.  You can do that from the command line with setserial on Linux, 
but it's probably easier to just stick with the defaults -- 115200 bps, 
8N1 -- and make your Arduino use that.




More information about the R-help mailing list