Skip to content

Requested changes for arduino/reference-en#750 #1

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 3 commits into from
Jul 15, 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
33 changes: 20 additions & 13 deletions Language/Functions/Bits and Bytes/bitClear.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ Clears (writes a 0 to) a bit of a numeric variable.
// OVERVIEW SECTION ENDS


// SEE ALSO SECTION
[#see_also]

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

[float]
Expand All @@ -51,26 +52,32 @@ Prints the output of `bitClear(x,n)` on two given integers. The binary represent

[source,arduino]
----
void setup()
{
Serial.begin(9600);
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()
{
int x = 6; int n = 1; //setting the value of x and n
Serial.print(bitClear(x,n)); //printing the output of the bitClear(x,n)
void loop() {
}
----
[%hardbreaks]

[float]
=== Notes and Warnings
The indexing of the rightmost bit starts from 0, so `n=1` clears the second bit from the right. If the bit at any given position is already zero, `x` is returned unchanged.
--
// HOW TO USE SECTION ENDS

Both `x` and `n` must be integers.


// SEE ALSO SECTION
[#see_also]
--

[float]
=== See also

--
Expand Down