I'm completely new to Arduino and trying to remember some school electronics from decades ago. Anyway, one of the first projects I've done is simply to add a pushbutton switch to switch an LED on and off on a circuit.
After struggling a bit and reading up on pullup resistors and using INPUT_PULLUP in the code etc. I pretty much understand what's going on.
But I have one question, if all I want to do is switch the LED on and off, why should I even bother with an input pin and the associated code? Is there anything fundamentally wrong with placing the pushbutton directly in the circuit, as per attached drawing? It seems the simplest way to do the job.
Thanks in advance!
If just a button turn on/off a LED, it just need t circuit as you showed. No MCU, no coding are required. The MCU and coding are required in the case the button and LED is part of a bigger project. You may see many tutorials just use a button to control LED. These tutorials are not for practice. They are for learning Arduino
Simple works just fine.
But but but, what if you want the LED to come on 60 seconds ‘after’ you push the switch ?
Thanks guys, much appreciated!
Most of the "buttons" used with Arduinos are momentary action. So the LED will only be only for as long as the button is being held down. If that's what you want then no microcontroller is needed.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.