({{, (RefLink[DeviceWriteBuffer, paclet:ref/DeviceWriteBuffer])[device,vals] 
fills the buffer on a device with the values vals.}, {, (RefLink[DeviceWriteBuffer, paclet:ref/DeviceWriteBuffer])[device,param->vals]
fills the buffer associated with the parameter param with the values vals.}, {, (RefLink[DeviceWriteBuffer, paclet:ref/DeviceWriteBuffer])[device,{(Subscript[param, 1])->(Subscript[vals, 1]),(Subscript[param, 2])->(Subscript[vals, 2]),…}]
fills the buffers associated with the (Subscript[param, i]) with the corresponding values (Subscript[vals, i]) .}})

OpenersNotesSection(Spacer1)Details

A device can be specified either by a (RefLink[DeviceObject, paclet:ref/DeviceObject]) or by a string representing a device class.

(RefLink[DeviceWriteBuffer, paclet:ref/DeviceWriteBuffer]) is a blocking function; when called, it communicates with the device and does not return until it has finished writing data.

(RefLink[DeviceWriteBuffer, paclet:ref/DeviceWriteBuffer])[device,vals] returns vals, even if for some reason the write operation fails.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Write a list of strings to the buffer of a demo device and retrieve the result:

dev=DeviceOpen["WriteDemo"];

DeviceWriteBuffer[dev,{"This","is","a","list"}];

DeviceReadBuffer[dev]

Close the device:

DeviceClose[dev]

Write a list of values to the buffer associated with a specified parameter:

dev=DeviceOpen["WriteDemo"]

DeviceWriteBuffer[dev,"date"->DateList[]]

Read the buffer to verify successful writing:

DeviceReadBuffer[dev,All,"date"]

OpenersExampleSection2(Spacer1)Applications  (2)

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

dev= DeviceOpen["Serial","/dev/ttyACM0"]

Write a string to the device buffer to light up an LED connected to the Arduino board:

DeviceWriteBuffer[dev,"LED On"];

Write a sequence of bytes to temporarily put a Sphero robotic ball in the sleep mode:

dev= DeviceOpen["SerialDemo","*Sphero*"]

str=FromCharacterCode[{255,255,0,34,5,6,0,5,0,0,0,205}];

DeviceWriteBuffer[dev,str];

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[DeviceWrite, paclet:ref/DeviceWrite])  ▪  (RefLink[DeviceExecute, paclet:ref/DeviceExecute])  ▪  (RefLink[DeviceReadBuffer, paclet:ref/DeviceReadBuffer])  ▪  (RefLink[DeviceExecuteAsynchronous, paclet:ref/DeviceExecuteAsynchronous])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Developing Device Drivers, paclet:tutorial/DevelopingDeviceDrivers])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Using Connected Devices, paclet:guide/UsingConnectedDevices])}, {▪(RefLinkPlain[Raspberry Pi, paclet:guide/RaspberryPi])}})}})