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