DeviceReadBuffer

DeviceReadBuffer[device]

reads the complete contents of the buffer on a device.

DeviceReadBuffer[device,n]

reads n elements from the buffer.

DeviceReadBuffer[device,crit]

reads elements from the buffer until the device-specific criterion crit is met.

DeviceReadBuffer[device,crit,param]

reads elements associated with the parameter param.

DeviceReadBuffer[device,crit,{param1,param2,}]

reads elements associated with the parami.

Details

  • A device can be specified either by a DeviceObject or by a string representing a device class.
  • DeviceReadBuffer is a blocking function; when called, it communicates with the device and does not return until it has the data it needs.
  • Not all devices have buffers. For those that do not, DeviceReadBuffer generates a message.

Examples

open allclose all

Basic Examples  (2)

Open a demo device and read the contents of its buffer:

Read the specified number of elements from the buffer:

Applications  (2)

Open a serial connection to an Arduino device running a custom program called sketch:

Read in Arduino's response:

Write a string of bytes to a Sphero serial device after opening a connection to it:

Read the specified number of bytes from the device buffer:

Read the rest of the response:

Write the same values and read the buffered response until a specified terminator is encountered:

Close the device connection:

Wolfram Research (2014), DeviceReadBuffer, Wolfram Language function, https://reference.wolfram.com/language/ref/DeviceReadBuffer.html.

Text

Wolfram Research (2014), DeviceReadBuffer, Wolfram Language function, https://reference.wolfram.com/language/ref/DeviceReadBuffer.html.

CMS

Wolfram Language. 2014. "DeviceReadBuffer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DeviceReadBuffer.html.

APA

Wolfram Language. (2014). DeviceReadBuffer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeviceReadBuffer.html

BibTeX

@misc{reference.wolfram_2024_devicereadbuffer, author="Wolfram Research", title="{DeviceReadBuffer}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DeviceReadBuffer.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_devicereadbuffer, organization={Wolfram Research}, title={DeviceReadBuffer}, year={2014}, url={https://reference.wolfram.com/language/ref/DeviceReadBuffer.html}, note=[Accessed: 21-November-2024 ]}