readInt8Array()
Description
Reads an 8-bit signed integer array from the serial port
Blocks execution until each byte is available
Reads the bytes, converts to signed int8 and adds them to the array
Unlike in MATLAB, the array is passed as an input argument.
Its memory location is passed to the function.
It does not need to be passed back as an output argument.
Syntax
readInt8Array(byte myArray, unsigned int nValues)
Parameters
myArray: the byte array to receive the data
nValues: the number of Int8's to read into the array (should not exceed array length)
Returns
None
Example
% This code reads an incoming signed int8 array from MATLAB
#include "ArCOM.h" // Include ArCOM library
ArCOM serialPort; // Create serial port object
int8_t myArray[10] = {0}; // Create an array of 10 Int8's
void setup() {
SerialUSB.begin(115200); // Initialize USB serial port
}
void loop() {
// Read an incoming Int8 array
serialPort.readInt8Array(myArray, 10);
}