Reference for Wiring version 0027+ If you have a previous version, use the reference includede with your software. If see any errors or have any comments, let us know.
| Class | Serial |
||
|---|---|---|---|
| Name | peek() |
||
| Examples | int val;
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
if( Serial1.available() > 0) {
val = Serial1.peek();
Serial.print("Next byte available on Serial1 is: ");
Serial.println(val);
}
} |
||
| Description | Returns the value of the next byte available without doing a reading. | ||
| Syntax | serial.peek() |
||
| Parameters |
|
||
| Returns | int: The value for the next byte of data available or -1 if no data is available. | ||
| Usage | Application |

