: outdata, outsize = sendCommand (ar, libname, commandid)
: outdata, outsize = sendCommand (ar, libname, commandid, data)
: outdata, outsize = sendCommand (ar, libname, commandid, data, timeout)

Send a command with option data to the connected arduino, waiting up to a specified number of seconds for a response.

Inputs

ar - connected arduino object.

libname - library sending the command. The name should match a programmed library of the arduino, or an error will be displayed.

commandid - integer value for the command being sent to the arduino.

data - optional data sent with the command.

timeout - optional timeout to wait for data

Outputs

outdata - data returned back from the arduino in response to command

outsize - size of data received

If the arduino fails to respond with a valid reply, sendCommand will error.

See also: arduino.

Package: arduino