Arduino

Serial

## peek()

#### Description

Returns the next byte (character) of incoming serial data without removing it from the internal serial buffer. That is, successive calls to peek() will return the same character, as will the next call to read(). peek() inherits from the Stream utility class.

#### Syntax

Serial.peek()

Arduino Mega only:
Serial1.peek()
Serial2.peek()
Serial3.peek()

### Parameters

None

#### Returns

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

#### See also

- begin()
- end()
- available()
- read()
- peek()
- flush()
- print()
- println()
- write()
- SerialEvent()
- Stream.peek()

Reference Home

### Share

### This link has expired.
Please re-subscribe to our Newsletters.

### Subscribe to our Newsletters

Email

Please enter a valid email to subscribe

Arduino Newsletter
Arduino Store Newsletter

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy

###### Newsletter

- ©2015 Arduino
- Copyright Notice
- Contact us
- About us
- Careers