r/arduino • u/No-Reach-9412 • Oct 18 '26
Beginner's Project Third Project: Button controlled LED
I should’ve most likely made this before I did my DHT11 project, but today i decided to find out how buttons work as I need them for my first actual project - more on that soon 😉. This was pretty simple today, one thing that confused me was buttonState, for some reason I assumed HIGH meant the button had been pressed (as in the button was on, as LED’s use HIGH to switch on). After I figured that out it was smooth sailing.
Just wanted to thank this sub for helping me on my first post to come up with some fun projects I can use to learn more basics! I really appreciate it.
2
u/CoffeeSalt2036 Oct 18 '26
wiring decides that, not the code. with INPUT_PULLUP the pin idles HIGH and reads LOW when pressed, so the logic flips. everyone hits this once.
1
u/DavidFromArduino Arduino Staff Oct 19 '26
looking good! don't forget to debounce! 💙
https://docs.arduino.cc/built-in-examples/digital/Debounce/