# 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():

    use arduboy_rust::prelude::*;
    if serial::available() > 0 {
        // read the incoming byte:
        let incoming_byte: &str = serial::read_as_utf8_str();

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