writeByteArray()

Description

Writes an array of bytes to the serial port

Syntax

writeByteArray(byte array, unsigned int size)

Parameters

  • array: a 1xN array of bytes.

  • size: the number of bytes to send from the array (must not exceed array length)

Returns

None

Example

// This writes a byte array to the serial port for MATLAB to read

#include "ArCOM.h" // Include ArCOM library

ArCOM serialPort(SerialUSB); // Create serial port object

byte myBytes[3] = {3, 4, 5}; // Create a byte array

void setup() {

SerialUSB.begin(115200); // Initialize USB serial port

}

void loop() {

// Send the byte array to MATLAB

serialPort.writeByteArray(myBytes, 3);

}