Skip to content

improve code example Indentation #658

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 1 commit into from
Nov 15, 2022
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
16 changes: 8 additions & 8 deletions content/learn/03.programming/09.bit-mask/bit-mask.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The AND (&) operator will result in a 1 at each bit position where both input va
For example:

```arduino
x: 10001101

x: 10001101
y: 01010111

x & y: 00000101
Expand All @@ -24,7 +24,7 @@ The OR (|) operator (also known as Inclusive Or) will result in a 1 at each bit
For example:

```arduino
x: 10001101
x: 10001101

y: 01010111

Expand All @@ -35,7 +35,7 @@ The Left Shift (<<) operator will shift a value to the left the specified number
For example:

```arduino
y = 1010
y = 1010

x = y << 1

Expand All @@ -48,7 +48,7 @@ The Right Shift (>>) operator works identically to left shift except that it shi
For example:

```arduino
y = 1010
y = 1010

x = y >> 1

Expand Down Expand Up @@ -97,7 +97,7 @@ void loop()
Here we use a FOR loop to iterate through a bit mask value, shifting the value one position left each time through the loop. In this example we use the <<= operator which is exactly like the << operator except that it compacts the statement

```arduino
00000001
00000001
& 10101010

________
Expand All @@ -109,12 +109,12 @@ And our output pin gets set to 0.
Second time through the loop the mask = 00000010, so our operation looks like:

```arduino
00000010
00000010
& 10101010

________

00000010
```

And our output pin gets set to 1. The loop will continue to iterate through each bit in the mask until the 1 gets shifted left off the end of the 8 bits and our mask =0. Then all 8 bits have been sent and our loop exits.
And our output pin gets set to 1. The loop will continue to iterate through each bit in the mask until the 1 gets shifted left off the end of the 8 bits and our mask =0. Then all 8 bits have been sent and our loop exits.