0% found this document useful (0 votes)
66 views2 pages

Read

arduino

Uploaded by

cristosebaceo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views2 pages

Read

arduino

Uploaded by

cristosebaceo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

E:PUBLIC&RESPONSE_TYPE=TOKEN&REDIRECT_URI=HTTPS%3A%2F%2FWWW.ARDUINO.

CC)

Serial (//www.arduino.cc/en/Reference/Serial)

read()
Description
Reads incoming serial data. read() inherits from the Stream (//www.arduino.cc/en/Reference/Stream)
utility class.

Syntax
Serial.read()

Arduino Mega only:


Serial1.read()
Serial2.read()
Serial3.read()

Parameters
None

Returns
the rst byte of incoming serial data available (or -1 if no data is available) - int

Example
int incomingByte = 0; // for incoming serial data

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {

// send data only when you receive data:


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

// say what you got:


Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}

[Get Code] (//www.arduino.cc/en/Serial/Read?action=sourceblock&num=1)

See also

- begin (//www.arduino.cc/en/Serial/Begin)()
- end (//www.arduino.cc/en/Serial/End)()
- available (//www.arduino.cc/en/Serial/Available)()
- read (//www.arduino.cc/en/Serial/Read)()
- peek (//www.arduino.cc/en/Serial/Peek)()
- ush (//www.arduino.cc/en/Serial/Flush)()
- print (//www.arduino.cc/en/Serial/Print)()
- println (//www.arduino.cc/en/Serial/Println)()
- write (//www.arduino.cc/en/Serial/Write)()
- SerialEvent (//www.arduino.cc/en/Reference/SerialEvent)()
- Stream.read (//www.arduino.cc/en/Reference/StreamRead)()
Reference Home (//www.arduino.cc/en/Reference/HomePage)

NEWSLETTER

ENTER YOUR EMAIL TO SIGN UP SUBSCRIBE

Copyright Notice (//www.arduino.cc/en/Main/CopyrightNotice)

Contact Us (//www.arduino.cc/en/Main/ContactUs)
About Us (//www.arduino.cc/en/Main/AboutUs)
Careers (//www.arduino.cc/Careers)
2017 Arduino

(https://www.facebook.com/official.arduino)
(https://twitter.com/arduino)
(https://plus.google.com/+Arduino)
(https://www.instagram.com/arduino.cc/)
(https://github.com/arduino/)
(https://www.flickr.com/photos/arduino_cc)
(https://www.youtube.com/user/arduinoteam)

You might also like