Reference.SoftwareSerialAvailable History

Hide minor edits - Show changes to output

May 25, 2012, at 03:44 PM by Tom Igoe -
Changed lines 23-25 from:
#define rxPin 2
#define txPin 3
to:
#define rxPin 10
#define txPin 11
January 07, 2012, at 06:32 PM by Tom Igoe -
Changed lines 19-20 from:
[@// include the SoftwareSerial library so you can use its functions:
to:
(:source lang=arduino tabwidth=4:)
// include the SoftwareSerial library so you can use its functions:
Changed lines 42-43 from:
@]
to:
(:sourceend:)
September 24, 2011, at 12:08 AM by Scott Fitzgerald - page creation
Added lines 1-48:
!!SoftwareSerial: available()

!!!!Description

Get the number of bytes (characters) available for reading from a software serial port. This is data that's already arrived and stored in the serial receive buffer.

!!!!Syntax
mySerial.available()

!!!!Parameters

none

!!!!Returns

the number of bytes available to read

!!!!Example
[@// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 3

// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

void setup() {
// define pin modes for tx, rx:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}

void loop() {
if (mySerial.available()>0){
mySerial.read();
}
}
@]

!!!!See also

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

Share