Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included 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); } void loop() { if ( Serial.available() > 0) { val = Serial.peek(); Serial.print("Next byte available 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 |