writeInt16()

writeInt16()

Description

Writes a 16-bit signed integer to the serial port.

Syntax

writeInt16(short myInt)

Parameters

  • myInt: an 16-bit signed integer to write to the serial port, of type short or int16_t.

Returns

None

Example

% This code writes an int16 to the serial port for MATLAB to read

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

ArCOM serialPort; // Create serial port object

short myInt = -923; // Create an 16-bit signed integer

void setup() {

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

}

void loop() {

serialPort.writeInt16(myInt); // Send the int16 to MATLAB

}