Skip to content

Commit 632dfb1

Browse files
committed
Merge branch 'master' of https://github.com/arduino/reference-en
2 parents d84844c + 5a4248c commit 632dfb1

File tree

14 files changed

+45
-42
lines changed

14 files changed

+45
-42
lines changed

Language/Functions/Advanced IO/pulseIn.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ subCategories: [ "Advanced I/O" ]
1717

1818
[float]
1919
=== Description
20-
Reads a pulse (either HIGH or LOW) on a pin. For example, if *value* is *HIGH*, `pulseIn()` waits for the pin to go *HIGH*, starts timing, then waits for the pin to go *LOW* and stops timing. Returns the length of the pulse in microseconds. Gives up and returns 0 if no pulse starts within a specified time out.
20+
Reads a pulse (either `HIGH` or `LOW`) on a pin. For example, if `value` is `HIGH`, `pulseIn()` waits for the pin to go from `LOW` to `HIGH`, starts timing, then waits for the pin to go `LOW` and stops timing. Returns the length of the pulse in microseconds or gives up and returns 0 if no complete pulse was received within the timeout.
2121

2222
The timing of this function has been determined empirically and will probably show errors in longer pulses. Works on pulses from 10 microseconds to 3 minutes in length.
2323
[%hardbreaks]

Language/Functions/Advanced IO/pulseInLong.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ subCategories: [ "Advanced I/O" ]
1717

1818
[float]
1919
=== Description
20-
Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, `pulseInLong()` waits for the pin to go `HIGH`, starts timing, then waits for the pin to go `LOW` and stops timing. Returns the length of the pulse in microseconds or 0 if no complete pulse was received within the timeout.
20+
`pulseInLong()` is an alternative to link:../pulsein[pulseIn()] which is better at handling long pulse and interrupt affected scenarios.
2121

22-
The timing of this function has been determined empirically and will probably show errors in shorter pulses. Works on pulses from 10 microseconds to 3 minutes in length. Please also note that if the pin is already high when the function is called, it will wait for the pin to go LOW and then HIGH before it starts counting. This routine can be used only if interrupts are activated. Furthermore the highest resolution is obtained with large intervals.
22+
Reads a pulse (either `HIGH` or `LOW`) on a pin. For example, if `value` is `HIGH`, `pulseInLong()` waits for the pin to go from `LOW` to `HIGH`, starts timing, then waits for the pin to go `LOW` and stops timing. Returns the length of the pulse in microseconds or gives up and returns 0 if no complete pulse was received within the timeout.
23+
24+
The timing of this function has been determined empirically and will probably show errors in shorter pulses. Works on pulses from 10 microseconds to 3 minutes in length. This routine can be used only if interrupts are activated. Furthermore the highest resolution is obtained with large intervals.
2325
[%hardbreaks]
2426

2527

Language/Functions/Communication/Serial.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ link:../serial/println[println()] +
5555
link:../serial/read[read()] +
5656
link:../serial/readbytes[readBytes()] +
5757
link:../serial/readbytesuntil[readBytesUntil()] +
58+
link:../serial/readstring[readString()] +
59+
link:../serial/readstringuntil[readStringUntil()] +
5860
link:../serial/settimeout[setTimeout()] +
5961
link:../serial/write[write()] +
6062
link:../serial/serialevent[serialEvent()]

Language/Functions/Communication/Serial/find.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Serial.find() inherits from the link:../../stream[stream] utility class.
3030

3131
[float]
3232
=== Returns
33-
`boolean`
33+
`bool`
3434

3535
--
3636
// OVERVIEW SECTION ENDS

Language/Functions/Communication/Serial/findUntil.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The function returns true if the target string is found, false if it times out.
3434

3535
[float]
3636
=== Returns
37-
`boolean`
37+
`bool`
3838

3939
--
4040
// OVERVIEW SECTION ENDS

Language/Functions/Communication/Serial/ifSerial.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Nothing
4444

4545
[float]
4646
=== Returns
47-
`boolean` : returns true if the specified serial port is available. This will only return false if querying the Leonardo's USB CDC serial connection before it is ready.
47+
`bool` : returns true if the specified serial port is available. This will only return false if querying the Leonardo's USB CDC serial connection before it is ready.
4848

4949
--
5050
// OVERVIEW SECTION ENDS

Language/Functions/Communication/Serial/print.adoc

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ Prints data to the serial port as human-readable ASCII text. This command can ta
1919
* `Serial.print(78) gives "78"` +
2020
* `Serial.print(1.23456) gives "1.23"` +
2121
* `Serial.print('N') gives "N"` +
22-
* `Serial.print("Hello world.") gives "Hello world." `
22+
* `Serial.print("Hello world.") gives "Hello world."`
2323

2424
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-
2525

2626
* `Serial.print(78, BIN) gives "1001110"` +
2727
* `Serial.print(78, OCT) gives "116"` +
2828
* `Serial.print(78, DEC) gives "78"` +
2929
* `Serial.print(78, HEX) gives "4E"` +
30-
* `Serial.println(1.23456, 0) gives "1"` +
31-
* `Serial.println(1.23456, 2) gives "1.23"` +
32-
* `Serial.println(1.23456, 4) gives "1.2346"`
30+
* `Serial.print(1.23456, 0) gives "1"` +
31+
* `Serial.print(1.23456, 2) gives "1.23"` +
32+
* `Serial.print(1.23456, 4) gives "1.2346"`
3333

34-
You can pass flash-memory based strings to Serial.print() by wrapping them with F(). For example:
34+
You can pass flash-memory based strings to Serial.print() by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example:
3535

3636
`Serial.print(F(“Hello World”))`
3737

38-
To send a single byte, use link:../write[Serial.write()].
38+
To send data without conversion to its representation as characters, use link:../write[Serial.write()].
3939
[%hardbreaks]
4040

4141

@@ -71,18 +71,16 @@ To send a single byte, use link:../write[Serial.write()].
7171
[source,arduino]
7272
----
7373
/*
74-
Uses a FOR loop for data and prints a number in various formats.
74+
Uses a for loop to print numbers in various formats.
7575
*/
76-
int x = 0; // variable
77-
7876
void setup() {
7977
Serial.begin(9600); // open the serial port at 9600 bps:
8078
}
8179
8280
void loop() {
8381
// print labels
84-
Serial.print("NO FORMAT"); // prints a label
85-
Serial.print("\t"); // prints a tab
82+
Serial.print("NO FORMAT"); // prints a label
83+
Serial.print("\t"); // prints a tab
8684
8785
Serial.print("DEC");
8886
Serial.print("\t");
@@ -94,10 +92,9 @@ void loop() {
9492
Serial.print("\t");
9593
9694
Serial.print("BIN");
97-
Serial.println("\t"); // carriage return after the last label
98-
99-
for(x=0; x< 64; x++){ // only part of the ASCII chart, change to suit
95+
Serial.println(); // carriage return after the last label
10096
97+
for (int x = 0; x < 64; x++) { // only part of the ASCII chart, change to suit
10198
// print it out in many formats:
10299
Serial.print(x); // print as an ASCII-encoded decimal - same as "DEC"
103100
Serial.print("\t\t"); // prints two tabs to accomodate the label lenght
@@ -112,10 +109,10 @@ void loop() {
112109
Serial.print("\t"); // prints a tab
113110
114111
Serial.println(x, BIN); // print as an ASCII-encoded binary
115-
// then adds the carriage return with "println"
112+
// then adds the carriage return with "println"
116113
delay(200); // delay 200 milliseconds
117114
}
118-
Serial.println(""); // prints another carriage return
115+
Serial.println(); // prints another carriage return
119116
}
120117
----
121118
[%hardbreaks]

Language/Functions/Communication/Serial/readStringUntil.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ title: Serial.readStringUntil()
1414

1515
[float]
1616
=== Description
17-
`readStringUntil()` reads characters from the serial buffer into a string. The function terminates if it times out (see link:../setTimeout[setTimeout()]).
17+
`readStringUntil()` reads characters from the serial buffer into a string. The function terminates if it times out (see link:../settimeout[setTimeout()]).
1818

1919
This function is part of the Stream class, and is called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[Stream class] main page for more information.
2020

@@ -56,8 +56,8 @@ The entire String read from the serial buffer, until the terminator character is
5656
* #LANGUAGE# link:../print[print()]
5757
* #LANGUAGE# link:../println[println()]
5858
* #LANGUAGE# link:../write[write()]
59-
* #LANGUAGE# link:../serialEvent[SerialEvent()]
60-
* #LANGUAGE# link:../../stream/streamParseFloat[stream.parseFloat()]
59+
* #LANGUAGE# link:../serialevent[SerialEvent()]
60+
* #LANGUAGE# link:../../stream/streamparsefloat[stream.parseFloat()]
6161

6262
--
6363
// SEE ALSO SECTION ENDS

Language/Functions/Communication/Stream/streamFind.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This function is part of the Stream class, and is called by any class that inher
3333

3434
[float]
3535
=== Returns
36-
`boolean`
36+
`bool`
3737

3838
--
3939
// OVERVIEW SECTION ENDS

Language/Functions/Communication/Stream/streamFindUntil.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This function is part of the Stream class, and is called by any class that inher
3333

3434
[float]
3535
=== Returns
36-
`boolean`
36+
`bool`
3737

3838
--
3939
// OVERVIEW SECTION ENDS

Language/Functions/Communication/Stream/streamFlush.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This function is part of the Stream class, and is called by any class that inher
3131

3232
[float]
3333
=== Returns
34-
`boolean`
34+
Nothing
3535

3636
--
3737
// OVERVIEW SECTION ENDS

Language/Functions/External Interrupts/attachInterrupt.adoc

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,25 @@ For more information on interrupts, see http://gammon.com.au/interrupts[Nick Gam
6060

6161
[float]
6262
=== Syntax
63-
`attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);` (recommended) +
64-
`attachInterrupt(interrupt, ISR, mode);` (not recommended) +
65-
`attachInterrupt(pin, ISR, mode);` (not recommended Arduino Due, Zero, MKR1000, 101 only)
63+
`attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);` (recommended) +
64+
`attachInterrupt(interrupt, ISR, mode);` (not recommended) +
65+
`attachInterrupt(pin, ISR, mode);` (not recommended Arduino Due, Zero, MKR1000, 101 only)
6666

6767

6868
[float]
6969
=== Parameters
70-
`interrupt`: the number of the interrupt (`int`) +
71-
`pin`: the pin number _(Arduino Due, Zero, MKR1000 only)_ +
72-
`ISR`: the ISR to call when the interrupt occurs; this function must take no parameters and return nothing. This function is sometimes referred to as an interrupt service routine. +
73-
`mode`: defines when the interrupt should be triggered. Four constants are predefined as valid values: +
70+
`interrupt`: the number of the interrupt (`int`) +
71+
`pin`: the pin number _(Arduino Due, Zero, MKR1000 only)_ +
72+
`ISR`: the ISR to call when the interrupt occurs; this function must take no parameters and return nothing. This function is sometimes referred to as an interrupt service routine. +
73+
`mode`: defines when the interrupt should be triggered. Four constants are predefined as valid values: +
7474

7575
* *LOW* to trigger the interrupt whenever the pin is low, +
7676
* *CHANGE* to trigger the interrupt whenever the pin changes value +
7777
* *RISING* to trigger when the pin goes from low to high, +
7878
* *FALLING* for when the pin goes from high to low. +
79-
The Due, Zero and MKR1000 boards allows also: +
79+
80+
The Due, Zero and MKR1000 boards allows also: +
81+
8082
* *HIGH* to trigger the interrupt whenever the pin is high.
8183

8284
[float]
@@ -126,10 +128,10 @@ Note that in the table below, the interrupt numbers refer to the number to be pa
126128

127129
[options="header"]
128130
|===================================================
129-
|Board | int.0 | int.1 | int.2 | int.3 | int.4 | int.5
130-
|Uno, Ethernet | 2 | 3 | | | |
131-
|Mega2560 | 2 | 3 | 21 | 20 | 19 | 18
132-
|32u4 based (e.g Leonardo, Micro) | 3 | 2 | 0 | 1 | 7 |
131+
|Board | int.0 | int.1 | int.2 | int.3 | int.4 | int.5
132+
|Uno, Ethernet | 2 | 3 | | | |
133+
|Mega2560 | 2 | 3 | 21 | 20 | 19 | 18
134+
|32u4 based (e.g Leonardo, Micro) | 3 | 2 | 0 | 1 | 7 |
133135
|===================================================
134136
For Due, Zero, MKR1000 and 101 boards the *interrupt number = pin number*.
135137

Language/Functions/USB/Mouse/mouseIsPressed.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ When there is no value passed, it checks the status of the left mouse button.
3737

3838
[float]
3939
=== Returns
40-
`boolean` : reports whether a button is pressed or not.
40+
`bool` : reports whether a button is pressed or not.
4141

4242
--
4343
// OVERVIEW SECTION ENDS

Language/Structure/Control Structure/goto.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ goto label; // sends program flow to the label
4646
[source,arduino]
4747
----
4848
for(byte r = 0; r < 255; r++){
49-
for(byte g = 255; g > -1; g--){
49+
for(byte g = 255; g > 0; g--){
5050
for(byte b = 0; b < 255; b++){
5151
if (analogRead(0) > 250){ goto bailout;}
5252
// more statements ...

0 commit comments

Comments
 (0)