# Function arduboy_rust::serial_print::read

source ·

    pub fn read() -> i16

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: 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.