Skip to content

Commit 4f8921e

Browse files
author
Akshay Sharma
committed
update serial.ParseInt
1 parent aba77e0 commit 4f8921e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Language/Functions/Communication/Serial/parseInt.adoc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@
1212

1313
[float]
1414
=== Description
15-
Looks for the next valid integer in the incoming serial stream. `parseInt()` inherits from the link:stream{ext-relative}[Stream] utility class.
15+
Looks for the next valid integer in the incoming serial `stream.parseInt()` inherits from the link:stream{ext-relative}[Stream] utility class.
1616

17-
If no valid integer is found within one second (adjustable through link:serialTimeout{ext-relative}[Serial.setTimeout()] ) a default value of 0 will be returned.
17+
18+
In particular:
19+
20+
* Initial characters that are not digits or a minus sign, are skipped; +
21+
* Parsing stops when no characters have been read for a configurable time-out value, or a non-digit is read; +
22+
* If no valid digits were read when the time-out (see Serial.setTimeout()) occurs, 0 is returned;
1823
[%hardbreaks]
1924

2025

2126
[float]
2227
=== Syntax
2328
`Serial.parseInt()`
24-
29+
`Serial.parseInt(char skipChar)`
2530

2631
_Arduino Mega only:_
2732

@@ -32,11 +37,11 @@ _Arduino Mega only:_
3237

3338
[float]
3439
=== Parameters
35-
Nothing
40+
`skipChar`: used to skip the indicated char in the search. Used for example to skip thousands divider.
3641

3742
[float]
3843
=== Returns
39-
`int` : the next valid integer
44+
`long` : the next valid integer
4045

4146
--
4247
// OVERVIEW SECTION ENDS

0 commit comments

Comments
 (0)