Serial.Available History

Hide minor edits - Show changes to markup

May 08, 2012, at 05:06 PM by David A. Mellis -
Changed lines 7-8 from:

Get the number of bytes (characters) available for reading from the serial port. This is data that's already arrived and stored in the serial receive buffer (which holds 128 bytes). available() inherits from the Stream utility class.

to:

Get the number of bytes (characters) available for reading from the serial port. This is data that's already arrived and stored in the serial receive buffer (which holds 64 bytes). available() inherits from the Stream utility class.

January 30, 2012, at 05:14 PM by Scott Fitzgerald -
Changed lines 74-75 from:
to:
January 30, 2012, at 04:52 PM by Scott Fitzgerald -
Changed lines 46-47 from:

@]

to:
Changed line 50 from:

[@

to:
November 04, 2011, at 06:07 PM by Scott Fitzgerald -
Changed lines 76-77 from:
to:
November 04, 2011, at 06:07 PM by Scott Fitzgerald -
Changed lines 7-8 from:

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

to:

Get the number of bytes (characters) available for reading from the serial port. This is data that's already arrived and stored in the serial receive buffer (which holds 128 bytes). available() inherits from the Stream utility class.

Changed line 27 from:

[@

to:
Changed lines 70-72 from:

@]

to:
Changed lines 76-77 from:
to:
February 01, 2010, at 05:14 PM by David A. Mellis -
Added lines 9-16:

Syntax

Serial.available()

Arduino Mega only:
Serial1.available()
Serial2.available()
Serial3.available()

February 01, 2010, at 05:10 PM by David A. Mellis -
Changed lines 1-2 from:

int Serial.available()

to:

Serial

available()

Changed lines 7-8 from:

Get the number of bytes (characters) available for reading over the serial port.

to:

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

Changed lines 11-12 from:

None

to:

none

Changed lines 15-16 from:

The number of bytes are available to read in the serial buffer, or 0 if none are available. If any data has come in, Serial.available() will be greater than 0. The serial buffer can hold up to 128 bytes.

to:

the number of bytes available to read

Deleted line 65:
Changed lines 67-69 from:
to:
May 22, 2009, at 10:40 AM by David A. Mellis -
Deleted lines 62-66:

Note:

Serial.available has a documented bug in it in Arduino v.0007. This will be patched in v.0008, but see this thread if you wish to patch Serial.available in Arduino 0007.

May 21, 2009, at 11:22 PM by Tom Igoe -
Added lines 37-62:

Arduino Mega example:

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);

}

void loop() {
  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte = Serial.read();
    Serial1.print(inByte, BYTE); 

  }
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.print(inByte, BYTE); 
  }
}

April 18, 2007, at 09:05 AM by David A. Mellis - incoming serial buffer size is 128, not 64.
Changed lines 13-14 from:

The number of bytes are available to read in the serial buffer, or 0 if none are available. If any data has come in, Serial.available() will be greater than 0. The serial buffer can hold up to 64 bytes.

to:

The number of bytes are available to read in the serial buffer, or 0 if none are available. If any data has come in, Serial.available() will be greater than 0. The serial buffer can hold up to 128 bytes.

April 18, 2007, at 04:23 AM by Paul Badger -
Deleted line 35:
April 18, 2007, at 04:22 AM by Paul Badger -
Changed lines 40-42 from:

Serial.available has a documented bug in it in Arduino v.0007. This will be patched in v.0008, but see this thread if you wish to patch Serial.available

to:

Serial.available has a documented bug in it in Arduino v.0007. This will be patched in v.0008, but see this thread if you wish to patch Serial.available in Arduino 0007.

April 18, 2007, at 04:21 AM by Paul Badger -
Changed lines 40-44 from:

Serial.available has a documented bug in it in Arduino v.0007. This will be patched in v.0008, but see this thread if you wish to patch .0007.

patch Serial.available

to:

Serial.available has a documented bug in it in Arduino v.0007. This will be patched in v.0008, but see this thread if you wish to patch Serial.available

April 18, 2007, at 04:20 AM by Paul Badger -
Changed lines 42-45 from:

[[http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1168309608

 | patch Serial.available]]

to:

patch Serial.available

April 18, 2007, at 04:19 AM by Paul Badger -
Changed lines 38-39 from:

Note: Serial.available has a documented bug in it in Arduino v.0007. This will be patched in v.0008, but see this thread if you wish to patch .0007.

to:

Note:

Serial.available has a documented bug in it in Arduino v.0007. This will be patched in v.0008, but see this thread if you wish to patch .0007.

April 18, 2007, at 04:19 AM by Paul Badger -
Changed lines 41-43 from:

| patch Serial.available() ]]

to:
 | patch Serial.available]]

April 18, 2007, at 04:17 AM by Paul Badger -
Changed lines 13-14 from:

how many bytes are available to read in the serial buffer, or 0 if there arent any. If any data has come in, Serial.available() will be greater than 0. The serial buffer can hold up to 64 bytes.

to:

The number of bytes are available to read in the serial buffer, or 0 if none are available. If any data has come in, Serial.available() will be greater than 0. The serial buffer can hold up to 64 bytes.

Changed lines 38-43 from:
to:

Note: Serial.available has a documented bug in it in Arduino v.0007. This will be patched in v.0008, but see this thread if you wish to patch .0007.

[[http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1168309608 | patch Serial.available() ]]

March 27, 2006, at 08:57 PM by Tom Igoe -
Changed lines 40-42 from:
to:
March 27, 2006, at 08:26 PM by Tom Igoe -
Changed lines 1-2 from:

Serial.available()

to:

int Serial.available()

March 27, 2006, at 08:25 PM by Tom Igoe -
Changed lines 1-2 from:

Serial.available()

to:

Serial.available()

March 27, 2006, at 08:24 PM by Tom Igoe -
Added lines 1-2:

Serial.available()

March 27, 2006, at 08:24 PM by Tom Igoe -
Deleted lines 0-1:

int serialAvailable()

March 27, 2006, at 08:22 PM by Tom Igoe -
March 27, 2006, at 08:21 PM by Tom Igoe -
Added lines 1-43:

int serialAvailable()

Description

Get the number of bytes (characters) available for reading over the serial port.

Parameters

None

Returns

how many bytes are available to read in the serial buffer, or 0 if there arent any. If any data has come in, Serial.available() will be greater than 0. The serial buffer can hold up to 64 bytes.

Example

int incomingByte = 0;	// for incoming serial data

void setup() {
	Serial.begin(9600);	// opens serial port, sets data rate to 9600 bps
}

void loop() {

	// send data only when you receive data:
	if (Serial.available() > 0) {
		// read the incoming byte:
		incomingByte = Serial.read();

		// say what you got:
		Serial.print("I received: ");
		Serial.println(incomingByte, DEC);
	}
}


See also

Reference Home

Share