Skip to content

Update min(), max(), abs(), ADD stream.adoc #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions Language/Functions/Communication/stream.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:source-highlighter: pygments
:pygments-style: arduino
:ext-relative: adoc

= Stream


// OVERVIEW SECTION STARTS
[#overview]
--

[float]
=== Description
Stream is the base class for character and binary based streams. It is not called directly, but invoked whenever you use a function that relies on it.

Stream defines the reading functions in Arduino. When using any core functionality that uses a `read()` or similar method, you can safely assume it calls on the Stream class. For functions like `print()`, Stream inherits from the Print class.

Some of the libraries that rely on Stream include :

* link:serial{ext-relative}[Serial] +
* link:{ext-relative}[Wire] +
* link:{ext-relative}[Ethernet Client] +
* link:{ext-relative}[Ethernet Server] +
* link:{ext-relative}[SD]


--
// OVERVIEW SECTION ENDS


// FUNCTIONS SECTION STARTS
[#functions]
--

'''

[float]
=== Functions
link:/Stream/streamAvailable{ext-relative}[available()] +
link:/Stream/streamRead{ext-relative}[read()] +
link:/Stream/streamFlush{ext-relative}[flush()] +
link:/Stream/streamFind{ext-relative}[find()] +
link:/Stream/streamFindUntil{ext-relative}[findUntil()] +
link:/Stream/streamPeek{ext-relative}[peek()] +
link:/Stream/streamReadBytes{ext-relative}[readBytes()] +
link:/Stream/streamReadBytesUntil{ext-relative}[readBytesUntil()] +
link:/Stream/streamReadString{ext-relative}[readString()] +
link:/Stream/streamReadStringUntil{ext-relative}[readStringUntil()] +
link:/Stream/streamParseInt{ext-relative}[parseInt()] +
link:/Stream/streamParseFloat{ext-relative}[parseFloat()] +
link:/Stream/streamSetTimeout{ext-relative}[setTimeout()]

'''

--
// FUNCTIONS SECTION ENDS
4 changes: 2 additions & 2 deletions Language/Functions/Math/abs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Because of the way the abs() function is implemented, avoid using other function
----
abs(a++); // avoid this - yields incorrect results

a++; // use this instead -
abs(a); // keep other math outside the function
abs(a); // use this instead -
a++; // keep other math outside the function
----
[%hardbreaks]

Expand Down
4 changes: 2 additions & 2 deletions Language/Functions/Math/max.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Because of the way the `max()` function is implemented, avoid using other functi
----
max(a--, 0); // avoid this - yields incorrect results

a--; // use this instead -
max(a, 0); // keep other math outside the function
max(a, 0); // use this instead -
a--; // keep other math outside the function
----
[%hardbreaks]

Expand Down
4 changes: 2 additions & 2 deletions Language/Functions/Math/min.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ Because of the way the `min()` function is implemented, avoid using other functi
----
min(a++, 100); // avoid this - yields incorrect results

a++;
min(a, 100); // use this instead - keep other math outside the function
min(a, 100);
a++; // use this instead - keep other math outside the function
----
[%hardbreaks]

Expand Down