Skip to content

Added Example Code/ Notes and warnings #750

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 5 commits into from
Jul 25, 2020
Merged
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
35 changes: 34 additions & 1 deletion Language/Functions/Bits and Bytes/bitClear.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,45 @@ Clears (writes a 0 to) a bit of a numeric variable.

[float]
=== Returns
Nothing
`x`: the value of the numeric variable after the bit at position `n` is cleared.

--
// OVERVIEW SECTION ENDS



// HOW TO USE SECTION STARTS
[#howtouse]
--

[float]
=== Example Code
// Describe what the example code is all about and add relevant code
Prints the output of `bitClear(x,n)` on two given integers. The binary representation of 6 is 0110, so when `n=1`, the second bit from the right is set to 0. After this we are left with 0100 in binary, so 4 is returned.

[source,arduino]
----
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

int x = 6;
int n = 1;
Serial.print(bitClear(x, n)); // print the output of bitClear(x,n)
}

void loop() {
}
----
[%hardbreaks]

--
// HOW TO USE SECTION ENDS



// SEE ALSO SECTION
[#see_also]
--
Expand Down