Skip to content

This project demonstrates how to interface a **push button switch** with the **Arduino UNO (ATmega328P)** using **register-level programming**, without any Arduino functions.

Notifications You must be signed in to change notification settings

asathiskumar98-byte/Push-Button-Interface-Register-Level-Arduino-UNO-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”˜ Push Button Interface β€” Register-Level (Arduino UNO)

This project demonstrates how to interface a push button switch with the Arduino UNO (ATmega328P) using register-level programming, without any Arduino functions.


βš™οΈ Hardware Used

  • Arduino UNO (ATmega328P)
  • Push Button Switch
  • LED (for output indication)
  • 220Ξ© Resistor (LED current limit)
  • Optional: Pull-down resistor (if not using internal pull-up)

πŸ”Œ Pin Configuration

Component Function Arduino Pin Port
Push Button Input D2 PD2
LED Output D12 PB4
VCC Power +5V β€”
GND Ground GND β€”

🧩 Code Explanation

  • DDRB |= (1 << DDB4) β†’ Configures PB4 as output (LED).
  • DDRD &= ~(1 << DDD2) β†’ Configures PD2 as input (button).
  • PORTD |= (1 << PD2) β†’ Activates internal pull-up resistor.
  • Logic check:
    • Pressed (LOW) β†’ LED ON
    • Released (HIGH) β†’ LED OFF

βš™οΈ Working Principle

  1. When the button is pressed, PD2 goes LOW, LED turns ON.
  2. When released, PD2 goes HIGH (via pull-up), LED turns OFF.

🧰 Build & Upload

  1. Compile using AVR-GCC, Atmel Studio, or PlatformIO.
  2. Upload the HEX file to Arduino UNO.
  3. Watch the LED respond instantly to button presses.

About

This project demonstrates how to interface a **push button switch** with the **Arduino UNO (ATmega328P)** using **register-level programming**, without any Arduino functions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages