writeUint16()
Description
Writes a 16-bit unsigned integer to the serial port
Breaks the 16-bit integer into two bytes
Sends the two bytes in the order MATLAB / Octave expects.
Syntax
writeUint16(unsigned short myInt)
Parameters
myInt: a 16-bit unsigned integer of type unsigned short or uint16_t.
Returns
None
Example
// This code writes a uint16 to the serial port for MATLAB to read
#include "ArCOM.h" // Include ArCOM library
ArCOM serialPort(SerialUSB); // Create serial port object
unsigned short myInt = 23323; // Create a uint16
void setup() {
SerialUSB.begin(115200); // Initialize USB serial port
}
void loop() {
serialPort.writeUint16(myInt); // Send the uint16 to MATLAB
}