AIM: To interface a digital input (push button) and blink and LED upon activation. COMPONENTS REQUIRED:
- 1 KΩ Resistor
- Arduino Uno
- Bread board
- USB Interfacing cable
- Jumper wires
- LED of choice THEORY : Arduino UNO The Uno is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. Technical specifications of Arduino UNO : Microcontroller ATmega168/328 Microcontroller ATmega168/328 Operating Voltage 5V Input Voltage (recommended) 7-12V Input Voltage (limits) 6-20V Digital I/O Pins 14 (of which 6 provide PWM output) Analog Input Pins 6 DC Current per I/O Pin 40 mA DC Current for 3.3V Pin 50 mA Flash Memory 16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by boot loader SRAM 1 KB (ATmega168) or 2 KB (ATmega328) EEPROM 512 bytes (ATmega168) or 1 KB (ATmega328) Clock Speed 16 MHz PIN DIAGRAM FOR ATMEGA 328
FIGURE-02 PROCEDURE Open tinker cad account
- Select Arduino uno , bread board , digital input and digital output
- Connect the circuit as given in the figure
- Develop the program and compile it for any errors
- .Execute the program
- Check the simulation
CIRCUIT DIAGRAM
FIGURE -03
PROGRAM
int buttonState = 0;
void setup()
{
pinMode(2,OUTPUT);
pinMode(13,INPUT);
}
void loop()
{
buttonState = digitalRead(13);
if (buttonState ==HIGH){
digitalWrite(2, HIGH);
}else{
digitalWrite(2, LOW);
}
delay(10);
}
Output of the simulation :
**RESULT: ** Arduino uno analog input functioning is learned and interfaced with digital input switch .