Control LED with Push button

Aim

How to use block based coding method to turn ON and OFF the LED using a push button.

Components required for the experiment

Arduino UNO Board, Breadboard, LED (any colour), Resistor (220 Ohms) and Push Button.

What is Push Button and where it is used?

A push button switch is a type of mechanical switch that is activated by pressing a button. It is typically used to provide a momentary contact closure that can be used to control electronic circuits. When the button is pressed, it completes an electrical circuit, allowing current to flow through the circuit. When the button is released, the circuit is broken, stopping the flow of current. Push button switches are commonly used in a variety of electronic applications, such as control panels, keyboards, and as input devices for microcontrollers like the Arduino. They are often used in combination with other electronic components to create more complex circuits and systems.

.    

 

 

 

 

 

 

 

 

 

 

Blocks

Let us build a block code to turn on and off the led when the push button is pressed.

1.  Go to the Sensors option on the left hand side and click on the Button option. Select the Button setup block and place it in the working area.