read.serialConnection: Reads from the serial interface.

Description Usage Arguments Details Value See Also Examples

View source: R/read.R

Description

This function reads from the serial interface as long as the buffer is not empty. The read takes place per line in normal operation mode. Here end-of-line characters (\n;\r) are clipped according to the settings (translation).

Usage

1

Arguments

con

serial connection

n

number of bytes to read. Only in binary mode. n=0 (default) reads the whole buffer at once.

Details

In binary (hex-) mode the read takes place per byte. The result is a raw vector of hexadecimal numbers. To get numeric values as.numeric function must be invoked. Mind: Values form 0x01 – 0x31 might be displayed as escaped characters like "\001" if they are interpreted as string. If the end-of-file character specified by eof is received the reading stops. A close(con)open(con) sequence must be invoked to reopen the connection. If n>0 <n> bytes will be read. In case of less than n bytes available the function returns the buffer without waiting for all n characters. If the result is empty (zero length) then the empty string ” is returned in ASCII mode or NA in binary mode.

Value

In normal mode the result is a string. In binary mode raw values will be returned

See Also

serial

Examples

1
 # See the top package documentation

Example output

Attaching package: 'serial'

The following object is masked from 'package:base':

    isOpen

Warning message:
no DISPLAY variable so Tk is not available 

serial documentation built on July 1, 2020, 10:53 p.m.