Loading...

Reference.SoftwareSerialPeek History

Hide minor edits - Show changes to output

May 25, 2012, at 09:48 AM 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 18, 2012, at 07:21 PM 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]]()



Bookmark and Share