You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Language/Functions/Communication/Serial/available.adoc
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,6 @@
2
2
title: Serial.available()
3
3
---
4
4
5
-
6
-
7
-
8
5
= available()
9
6
10
7
@@ -31,20 +28,21 @@ _Arduino Mega only:_
31
28
32
29
[float]
33
30
=== Parameters
34
-
Nothing
31
+
None
35
32
36
33
[float]
37
34
=== Returns
38
35
The number of bytes available to read .
39
36
--
40
37
// OVERVIEW SECTION ENDS
41
38
42
-
43
-
44
-
45
39
// HOW TO USE SECTION STARTS
46
40
[#howtouse]
47
41
--
42
+
[float]
43
+
=== Example Code
44
+
// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
45
+
The following code returns a character received through the serial port.
48
46
49
47
[source,arduino]
50
48
----
@@ -56,7 +54,7 @@ void setup() {
56
54
57
55
void loop() {
58
56
59
-
// send data only when you receive data:
57
+
// reply only when you receive data:
60
58
if (Serial.available() > 0) {
61
59
// read the incoming byte:
62
60
incomingByte = Serial.read();
@@ -70,6 +68,8 @@ void loop() {
70
68
[%hardbreaks]
71
69
72
70
*Arduino Mega example:*
71
+
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.
0 commit comments