# Function arduboy_rust::serial_print::read_as_utf8_str

source ·

    pub fn read_as_utf8_str() -> &'static str

Expand description

Reads incoming serial data.

Use only inside of available():

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

        // 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: &str.