pub fn read() -> i16
Expand description

Reads incoming serial data. Use only inside of available():

if (Serial::available() > 0) {
    // read the incoming byte:
    let incomingByte: i16 = Serial::read();

    // say what you got:
    Serial::print("I received: ");
    Serial::println(incomingByte);
}

Returns

The first byte of incoming serial data available (or -1 if no data is available). Data type: int.