Created
August 20, 2024 21:24
-
-
Save futureshocked/8d6b34e7e0abd0e121c5ff10a74cf483 to your computer and use it in GitHub Desktop.
convert the 4-bit code in the dip_switch array into an integer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte encodebool(boolean* arr) | |
{ | |
byte val = 0; | |
for (int i = 0; i<4; i++) | |
{ | |
val <<= 1; | |
if (arr[i]) val |= 1; | |
} | |
return val; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment