Skip to content

Fixed Example code section #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Language/Functions/Communication/Serial/available.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
title: Serial.available()
---




= available()


Expand All @@ -31,20 +28,21 @@ _Arduino Mega only:_

[float]
=== Parameters
Nothing
None

[float]
=== Returns
The number of bytes available to read .
--
// OVERVIEW SECTION ENDS




// HOW TO USE SECTION STARTS
[#howtouse]
--
[float]
=== Example Code
// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
The following code returns a character received through the serial port.

[source,arduino]
----
Expand All @@ -56,7 +54,7 @@ void setup() {

void loop() {

// send data only when you receive data:
// reply only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
Expand All @@ -70,6 +68,8 @@ void loop() {
[%hardbreaks]

*Arduino Mega example:*
This code sends data received in one serial port of the Arduino Mega to another. This can be used, for example, to connect a serial device to the computer through the Arduino board.

[source,arduino]
----
void setup() {
Expand Down