Reading Arduino data directly into R

I have experimented with reading an Arduino signal into R in the past, using Rserve and Processing. Actually, it is much easier. I can read the output of my Arduino directly into R with the scan function. Here is my temperature sensor example again: And all it needs to read the signal into the R console with my computer is: > f <- file("/dev/cu.usbmodem3a21", open="r") > scan(f, n=1) <b>Read 1 item</b> [1] 20.