readInt8()

Description

Reads an 8-bit signed integer from the serial port

  • Blocks execution until 1 byte is available

  • Reads the byte, converts it into an unsigned int8 and returns it.

Syntax

myInt = readInt8()

Parameters

None

Returns

  • myInt: a int8_t read from the serial port.

Example

% This code reads an incoming int8 from MATLAB

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

ArCOM serialPort; // Create serial port object

int8_t myInt = 0; // Create an int8

void setup() {

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

}

void loop() {

myInt = serialPort.readInt8(); // Read an incoming int8

}