readByte()

Description

Reads a byte from the serial port

  • Blocks execution until 1 byte is available

  • Reads the byte and returns it.

Syntax

myByte = readByte()

Parameters

None

Returns

  • myByte: a byte read from the serial port.

Example

% This code reads an incoming byte from MATLAB

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

ArCOM serialPort(SerialUSB); // Create serial port object

byte myByte = 0; // Create a byte

void setup() {

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

}

void loop() {

myByte = serialPort.readByte(); // Read an incoming byte

}