Reference.SoftwareSerialPeek History

Hide minor edits - Show changes to output

May 25, 2012, at 03:48 PM by Tom Igoe -
Changed lines 1-2 from:
!!SoftwareSerial: int peek()
to:
!!SoftwareSerial: peek
Changed lines 20-21 from:
SoftwareSerial mySerial(6, 7);
to:
SoftwareSerial mySerial(10,11);
February 19, 2012, at 01:21 AM by David A. Mellis -
Added lines 1-39:
!!SoftwareSerial: int peek()

!!!!Description

Return a character that was received on the RX pin of the software serial port. Unlike [[SoftwareSerialRead | 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 [[SoftwareSerialListen | listen()]] function).

!!!!Parameters

none

!!!!Returns

the character read, or -1 if none is available

!!!!Example

(:source lang=arduino tabwidth=4:)
SoftwareSerial mySerial(6, 7);

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

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

!!!!See also

* [[SoftwareSerialConstructor | SoftwareSerial]]()
* [[SoftwareSerialBegin | begin]]()
* [[SoftwareSerialPrint | print]]()
* [[SoftwareSerialPrintln | println]]()
* [[SoftwareSerialRead | read]]()

Share