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 allclose all

Basic Examples  (1)

Open a demo device and write an expression to it:

Read from the device to verify successful writing:

Write a sequence of expressions and read the result:

Close the device:

Applications  (3)

Open a connection to a weather station device, configure it for writing, and write a string to the attached LCD:

Configure the pin direction of a GPIO device, e.g. on Raspberry Pi, and set it to digital "High":

Write a string of bytes to a Sphero robotic ball:

Read in the device response:

Introduced in 2014
 (10.0)