Skip to content

Commit 33e148e

Browse files
committed
Add explanation to the exercise 1.
1 parent 28025b2 commit 33e148e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/button.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ Now it's time for you to try and extend the program to read the GPIO input state
2727
}
2828
```
2929

30+
### Explanation
31+
32+
You may be tempted to think that `high` means ON and `low` means off, however, the logic of both the button and the LED
33+
is inverted.
34+
35+
Button has a pull-up resistor and connects the pin to ground when pressed.
36+
37+
The LED has its anode connected to the 3.3 V supply and the cathode is connected to the open-drain output. When the output is set to low, it is connected to ground, allowing the current to flow and thereby turning the LED on.
38+
3039
</details>
3140

3241
[1]: https://docs.espressif.com/projects/rust/esp-hal/1.0.0-rc.0/esp32c6/esp_hal/gpio/struct.Input.html

0 commit comments

Comments
 (0)