readInt32()

readInt32()

readInt32()

Description

Reads a 32-bit signed integer from the serial port

  • Blocks execution until 4 bytes are available

  • Reads the bytes, combines them into an int32 and returns it.

Syntax

myInt = readInt32()

Parameters

None

Returns

  • myInt: a long or int32_t read from the serial port.

Example

% This code reads an incoming int32 from MATLAB

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

ArCOM serialPort; // Create serial port object

long myInt = 0; // Create an int32

void setup() {

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

}

void loop() {

myInt = serialPort.readInt32(); // Read an incoming int32

}