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.
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 all close allBasic Examples (2)
Applications (2)
Open a serial connection to an Arduino device running a custom program called sketch:
dev = DeviceOpen["Serial", "/dev/ttyACM0"]FromCharacterCode[DeviceReadBuffer[dev]]Write a string of bytes to a Sphero serial device after opening a connection to it:
dev = DeviceOpen["SerialDemo", "*Sphero*"]val = FromCharacterCode[{255, 255, 0, 1, 5, 1, 248}];DeviceWrite[dev, val]Read the specified number of bytes from the device buffer:
DeviceReadBuffer[dev, 4]Read the rest of the response:
DeviceReadBuffer[dev]Write the same values and read the buffered response until a specified terminator is encountered:
DeviceWrite[dev, val];crit = "ReadTerminator" -> 1;DeviceReadBuffer[dev, crit]DeviceClose[dev]Tech Notes
Related Guides
History
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_2026_devicereadbuffer, author="Wolfram Research", title="{DeviceReadBuffer}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DeviceReadBuffer.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_devicereadbuffer, organization={Wolfram Research}, title={DeviceReadBuffer}, year={2014}, url={https://reference.wolfram.com/language/ref/DeviceReadBuffer.html}, note=[Accessed: 12-June-2026]}