readUint16()
Description
Reads a 16-bit unsigned integer from the serial port
Blocks execution until 2 bytes are available
Reads the bytes, combines them into a uint16 and returns it.
Syntax
myInt = readUint16()
Parameters
None
Returns
myInt: an unsigned short or uint16_t read from the serial port.
Example
// This code reads an incoming uint16 from MATLAB
#include "ArCOM.h" // Include ArCOM library
ArCOM serialPort(SerialUSB); // Create serial port object
unsigned short myInt = 0; // Create a uint16
void setup() {
SerialUSB.begin(115200); // Initialize USB serial port
}
void loop() {
myInt = serialPort.readUint16(); // Read an incoming uint16
}