Skip to content

Commit 3464207

Browse files
author
Your Name
committed
Merge branch 'Language_content' of github.com:arduino/reference-en into Language_content
2 parents d1a4cfb + 97dd879 commit 3464207

File tree

19 files changed

+837
-891
lines changed

19 files changed

+837
-891
lines changed

Language/Functions/Advanced IO/noTone.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:ext-relative: adoc
44

55

6-
= Entity title()
6+
= noTone()
77

88

99
// OVERVIEW SECTION STARTS

Language/Functions/Analog IO/analogRead.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ If the analog input pin is not connected to anything, the value returned by anal
7979
[role="language"]
8080
* #LANGUAGE# link:analogReference{ext-relative}[analogreference()] +
8181
* #LANGUAGE# link:analogReadResolution{ext-relative}[analogReadResolution()] +
82-
* #LANGUAGE# (http://arduino.cc/en/Tutorial/AnalogInputPins[Tutorial: Analog Input Pins])
82+
* #LANGUAGE# http://arduino.cc/en/Tutorial/AnalogInputPins[Tutorial: Analog Input Pins]
8383

8484

8585
--

Language/Functions/Communication/Serial/findUntil.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
[float]
1414
=== Description
15-
Serial.findUntil() reads data from the serial buffer until a target string of given length or terminator string is found.
15+
`Serial.findUntil()` reads data from the serial buffer until a target string of given length or terminator string is found.
1616

1717
The function returns true if the target string is found, false if it times out.
1818

19-
Serial.findUntil() inherits from the link:stream{ext-relative}[Stream] utility class.
19+
`Serial.findUntil()` inherits from the link:stream{ext-relative}[Stream] utility class.
2020
[%hardbreaks]
2121

2222

Language/Functions/Communication/Serial/print.adoc

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,44 @@
1212

1313
[float]
1414
=== Description
15+
Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is. For example-
16+
17+
* `Serial.print(78) gives "78"` +
18+
* `Serial.print(1.23456) gives "1.23"` +
19+
* `Serial.print('N') gives "N"` +
20+
* `Serial.print("Hello world.") gives "Hello world." `
21+
22+
An optional second parameter specifies the base (format) to use; permitted values are `BIN(binary, or base 2)`, `OCT(octal, or base 8)`, `DEC(decimal, or base 10)`, `HEX(hexadecimal, or base 16)`. For floating point numbers, this parameter specifies the number of decimal places to use. For example-
23+
24+
* `Serial.print(78, BIN) gives "1001110"` +
25+
* `Serial.print(78, OCT) gives "116"` +
26+
* `Serial.print(78, DEC) gives "78"` +
27+
* `Serial.print(78, HEX) gives "4E"` +
28+
* `Serial.println(1.23456, 0) gives "1"` +
29+
* `Serial.println(1.23456, 2) gives "1.23"` +
30+
* `Serial.println(1.23456, 4) gives "1.2346"`
31+
32+
You can pass flash-memory based strings to Serial.print() by wrapping them with F(). For example :
33+
34+
`Serial.print(F(“Hello World”))`
35+
36+
To send a single byte, use link:serialWrite{ext-relative}[Serial.write()].
1537
[%hardbreaks]
1638

1739

1840
[float]
1941
=== Syntax
20-
42+
`Serial.print(val)` +
43+
`Serial.print(val, format)`
2144

2245

2346
[float]
2447
=== Parameters
25-
48+
`val`: the value to print - any data type
2649

2750
[float]
2851
=== Returns
29-
Nothing
52+
`size_t (long)`: `print()` returns the number of bytes written, though reading that number is optional.
3053

3154
--
3255
// OVERVIEW SECTION ENDS
@@ -45,12 +68,59 @@ Nothing
4568

4669
[source,arduino]
4770
----
71+
/*
72+
Uses a FOR loop for data and prints a number in various formats.
73+
*/
74+
int x = 0; // variable
75+
76+
void setup() {
77+
Serial.begin(9600); // open the serial port at 9600 bps:
78+
}
79+
80+
void loop() {
81+
// print labels
82+
Serial.print("NO FORMAT"); // prints a label
83+
Serial.print("\t"); // prints a tab
84+
85+
Serial.print("DEC");
86+
Serial.print("\t");
87+
88+
Serial.print("HEX");
89+
Serial.print("\t");
90+
91+
Serial.print("OCT");
92+
Serial.print("\t");
93+
94+
Serial.print("BIN");
95+
Serial.print("\t");
96+
97+
for(x=0; x< 64; x++){ // only part of the ASCII chart, change to suit
98+
99+
// print it out in many formats:
100+
Serial.print(x); // print as an ASCII-encoded decimal - same as "DEC"
101+
Serial.print("\t"); // prints a tab
102+
103+
Serial.print(x, DEC); // print as an ASCII-encoded decimal
104+
Serial.print("\t"); // prints a tab
105+
106+
Serial.print(x, HEX); // print as an ASCII-encoded hexadecimal
107+
Serial.print("\t"); // prints a tab
108+
109+
Serial.print(x, OCT); // print as an ASCII-encoded octal
110+
Serial.print("\t"); // prints a tab
48111
112+
Serial.println(x, BIN); // print as an ASCII-encoded binary
113+
// then adds the carriage return with "println"
114+
delay(200); // delay 200 milliseconds
115+
}
116+
Serial.println(""); // prints another carriage return
117+
}
49118
----
50119
[%hardbreaks]
51120

52121
[float]
53122
=== Notes and Warnings
123+
As of version 1.0, serial transmission is asynchronous; `Serial.print()` will return before any characters are transmitted.
54124
[%hardbreaks]
55125

56126
[float]

Language/Functions/Communication/Stream/streamFindUntil.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:ext-relative: adoc
44

55

6-
= Entity title()
6+
= `findUntil()`
77

88

99
// OVERVIEW SECTION STARTS

0 commit comments

Comments
 (0)