Hardware Reference
In-Depth Information
Table 1-1. Stream Member Functions
Function
Description
void setTimeout(unsigned long timeout); Sets the timeout value for stream functions. If the process takes too
long, it returns. The default is configured for 1000 ms, which is
1 second. The constructor sets this value.
bool find(char *target); Searches the stream for the target string. Returns true if found,
otherwise false . Also, will return as false if a timeout occurs.
bool find(char *target, size_t length); Reads the stream until a target string of a specific length is found.
bool findUntil(char *target, char
*terminator);
Works according to the same logic as find() , but returns true when
a terminator string is found.
bool findUntil(char *target, size_t
targetLen, char *terminate, size_t
termLen);
Within a particular buffer and length, returns true if a termination
string is found or the length reached.
long parseInt();
Searches for the first valid ( long ) integer from the current position.
Initial characters that are not digits (0 through 9) or the minus sign
are skipped; once a non-digit is found, the value is returned.
float parseFloat();
Searches for the first valid float from the current position, ignoring
characters that are not digits or the minus sign. Once a non-digit is
found that is not a period (.), the value is returned.
size_t readBytes(char *buffer, size_t
length);
Reads characters from the stream into the buffer. If a length or
timeout is reached, the function returns either 0 (for no data found)
or the number of characters in the buffer.
size_t readBytesUntil(char terminator,
char *buffer, size_t length);
Reads characters from the stream into the buffer. If a terminator
character, length, or timeout is reached, the function returns 0
(for no data found) or the number of characters in the buffer.
long parseInt(char skipChar);
Allows for the parsing of integers and for a character (e.g., a comma)
to be skipped.
float parseFloat(char skipChar);
Works similarly to parseFloat() , but ignores the skip character.
Print
The Print class has been updated. This affects the Client and Stream classes directly. The classes that include
them are affected as well. The HardwareSerial and UDP classes use Stream . Therefore, you do not specifically have
to include Print in your main Arduino sketch. Table 1-2 shows some of the more important updates to the public
methods.
 
 
Search WWH ::




Custom Search