writeUint16Array()

Description

Writes an array of unsigned 16-bit integers to the serial port

Syntax

writeUint16Array(unsigned short array, unsigned int size)

Parameters

  • array: a 1xN array of 16-bit integers of type unsigned short or uint16_t.

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

Returns

None

Example

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

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

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

unsigned short myInts[3] = {3, 4000, 523}; // Create array

void setup() {

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

}

void loop() {

// Send the uint16 array to MATLAB

serialPort.writeUint16Array(myInts, 3);

}