Using Push Button Switch with Atmega32 and Atmel Studio

This tutorial is meant for beginners in the field of Atmel AVR programming. I hope that you already read my first tutorial Blinking LED using Atmega32 and Atmel Studio. In most of the embedded electronic projects you may want to use a push button switch to give user inputs to the microcontroller. To use a push button switch with a microcontroller, first you should configure the corresponding pin as input. Then we can easily read the status of that input pin and make required decisions. There are two types of push button switches Push To On and Push To Off, here we are using Push To On switch. In this tutorial a press at the switch turns ON the LED for 3 seconds.
As described in the first tutorial 16 MHz crystal is used to provide clock to the Atmega32 microcontroller. 10µF capacitor and 10KΩ resistor is used to provide Power On Reset (POR) during the startup of microcontroller. LED is connected to the first pin of PORTC (PC0) of the microcontroller and a resistor is used to limit current through it. Push Button Switch is connected to the first pin of PORTD (PD0) of the microcontroller and a pull down resistor is provided to make the input LOW whenever the switch remain unpressed.
for more detail:  Using Push Button Switch with Atmega32 and Atmel Studio

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top