pub fn read() -> i16
Expand description

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

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

    // say what you got:
    serial::print("I received: ");
    serial::println(incoming_byte);
}

Returns

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