ezieragabriel / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

parseInt documentation does not state the call may time out and return a default value #1070

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use `Serial.parseInt()` in a sketch.
2. Rather than blocking when no valid input is received a default value of zero 
is returned. 
3. Look at the documentation of `parseInt()` for mention of the 
non-blocking/time out nature of the call.

What is the expected output? What do you see instead?

The description section of <http://arduino.cc/en/Serial/ParseInt> should 
include the sentence: "If no valid integer is found within a certain elapsed 
time (as set by Serial.setTimeout() with a default of one second) then a 
default value (0) will be returned." 

No mention of the time out is seen in the current documentation.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?

1.0.1 / NA / NA

Please provide any additional information below.

This change should also be made to: 
<http://arduino.cc/en/Reference/StreamParseInt>

The documentation for `Serial.setTimeOut()` 
<http://arduino.cc/en/Serial/SetTimeout> should probably mention the time out 
affects the `parse*` group of methods as they use the `read*` group of methods.

Original issue reported on code.google.com by follower@gmail.com on 13 Oct 2012 at 6:42

GoogleCodeExporter commented 9 years ago

Original comment by s.fitzge...@arduino.cc on 5 Jun 2013 at 4:48