DeviceWrite[device,val]
writes the value val to the specified device.
DeviceWrite[device,{val1,val2,…}]
writes the sequence of values vali to the specified device.
DeviceWrite[device,paramval]
writes val as the value of the parameter param.
DeviceWrite[device,{param1val1,param2val2,…}]
writes values of several parameters.
DeviceWrite
DeviceWrite[device,val]
writes the value val to the specified device.
DeviceWrite[device,{val1,val2,…}]
writes the sequence of values vali to the specified device.
DeviceWrite[device,paramval]
writes val as the value of the parameter param.
DeviceWrite[device,{param1val1,param2val2,…}]
writes values of several parameters.
Details
- A device can be specified either by a DeviceObject or by a string representing a device class.
- DeviceWrite is a blocking function; when called, it communicates with the device and does not return until it has finished writing data.
- DeviceWrite[device,vals] returns vals, even if for some reason the write operation fails.
Examples
open all close allBasic Examples (1)
Open a demo device and write an expression to it:
dev = DeviceOpen["WriteDemo"]DeviceWrite[dev, $OperatingSystem];Read from the device to verify successful writing:
DeviceRead[dev]Write a sequence of expressions and read the result:
DeviceWrite["WriteDemo", {"a string", Subsuperscript[∫, a, b]Sin[x]ⅆx}];DeviceReadList[dev, 3]DeviceClose[dev]Applications (3)
Open a connection to a weather station device, configure it for writing, and write a string to the attached LCD:
dev = DeviceOpen["TinkerForgeWeatherStation"]DeviceConfigure[dev, "LCDBrickletUID" -> "gLp"];DeviceWrite[dev, "This is a string"];Configure the pin direction of a GPIO device, e.g. on Raspberry Pi, and set it to digital "High":
DeviceConfigure["GPIO", 4 -> "Output"];DeviceWrite["GPIO", 4 -> 1]Write a string of bytes to a Sphero robotic ball:
dev = DeviceOpen["SerialDemo", "*Sphero*"]DeviceWrite[dev, FromCharacterCode[{255, 255, 0, 1, 5, 1, 248}]];DeviceReadBuffer[dev]Tech Notes
Related Guides
Related Workflows
- Access GPIO on Raspberry Pi
History
Text
Wolfram Research (2014), DeviceWrite, Wolfram Language function, https://reference.wolfram.com/language/ref/DeviceWrite.html.
CMS
Wolfram Language. 2014. "DeviceWrite." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DeviceWrite.html.
APA
Wolfram Language. (2014). DeviceWrite. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeviceWrite.html
BibTeX
@misc{reference.wolfram_2026_devicewrite, author="Wolfram Research", title="{DeviceWrite}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DeviceWrite.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_devicewrite, organization={Wolfram Research}, title={DeviceWrite}, year={2014}, url={https://reference.wolfram.com/language/ref/DeviceWrite.html}, note=[Accessed: 12-June-2026]}