Arduino Function: SoftwareSerial.peek

Description

Return a character that was received on the RX pin of the software serial port. Unlike read(), however, subsequent calls to this function will return the same character. Note that only one SoftwareSerial instance can receive incoming data at a time (select which one with the listen() function).

Returns

 the character read, or -1 if none is available

Examples

SoftwareSerial mySerial(10,11);

void setup() {
mySerial.begin(9600);
}

void loop() {
char c = mySerial.peek();
}


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc