Interfacing With Inputs & Outputs
We will write a program that reads an input coming from a pushbutton and changes the state of a led every time the button is pressed .
first of all let’s analyzing our components , we have a push button who deliver just High or Low signal (it can be On ‘1’or Off ’0’) so we have a digital input , in the other hand the Led will change his state On and Off during the program so it also a digital output so we have :
- 1 digital Input : Push button
- 1 digital Output: Led
Now let’s do the wiring diagram for this circuit :
We use an online open source development tool named Tinkercad powered by Autodesk that offers us wide options to make electronic circuits, with microcontrollers and program them .
the circuit consist to make a pullup push button to read the active state as High level by introduce a resistor with the push button, also we have add a resistor to the led in order to protect it by limiting the current who pass through
the Arduino Ide code of this project is given below:
The Simulation of the circuit and the code are available in the link below :
https://www.tinkercad.com/things/bQm1FLWEsOE-led-blinking