in this video, i have explained how to use a push button to blink an LED bulb with arduino. there are 2 ways to use a push button. toggle and momentary.
a toggle switch will turn the led on if pressed once,
and turn it off when pressed again.
a momentary button will keep the led on until the button is pressed.
and turn it of when released
we will require an arduino
push button
led bulb
4.k7 ohm resistor
and some wires
connect a pull down resistor from -ve leg of the button to the breadboard ground
connect the breadboard ground to arduino ground
connect breadboard vcc to arduino 5v
connect signal pin after first leg of the resistor to pin 2 of the arduino
connect the led to pin 13 and ground of arduino
for momentary switch, the code is already present in arduino examples.
go to examples/digital/button
upload the code and you can control the led via the button.
pressing the button will turn the led on, and releasing it will turn it off.
in the toggle switch code, we have a variable code called status, which store the
last state of the button.
if the state is true or on, it changes it to false or off, and vice versa.
Code: https://bit.ly/3bV0As2
upload the code and use the button.
when the button is pressed once, the led turns on
and when the button is pressed again, the led turns off.
hope you found the tutorial useful
Solder Iron i Use: http://bit.ly/2GSArih
Helping Hand Magnifier: http://bit.ly/2Uh11oe
arduino uno Micro USB: http://bit.ly/aRdUiNo
also do check out these cool 3d Printers:
Creality Ender 3 pro : http://bit.ly/36m1POI
Creality CR-10s pro: http://bit.ly/2QmqU6z
#Arduino #Button #Tutorial #SuperbTech