File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Language/Functions/Bits and Bytes Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,32 @@ Nothing
4242// OVERVIEW SECTION ENDS
4343
4444
45+ // HOW TO USE SECTION STARTS
46+ [#howtouse]
47+ --
48+
49+ [float]
50+ === Example Code
51+ Demonstrates the use of bitWrite by printing the value of a variable to the Serial Monitor before and after the use of `bitWrite()`.
52+
53+
54+ [source,arduino]
55+ void setup() {
56+ Serial.begin(9600);
57+ while (!Serial) {} // wait for serial port to connect. Needed for native USB port only
58+ byte x = 0b10000000; // the 0b prefix indicates a binary constant
59+ Serial.println(x, BIN); // 10000000
60+ bitWrite(x, 0, 1); // write 1 to the least significant bit of x
61+ Serial.println(x, BIN); // 10000001
62+ }
63+
64+ void loop() {}
65+ ----
66+ [%hardbreaks]
67+ --
68+ // HOW TO USE SECTION ENDS
69+
70+
4571// SEE ALSO SECTION
4672[#see_also]
4773--
You can’t perform that action at this time.
0 commit comments