fbpx

Interface Switch With AVR

Description

The switch is a component that connects two points in a circuit when you press it.

LED turns on when you press the button.

Hardware Required

  • Push Button.
  • Atmega16 MicroController.

Circuit

Virtual Circuit

Code

 #include <avr/io.h>
 #include <util/delay.h>
 int main(void)
 {
 DDRA= 0x01;
 DDRC= 0x00;
 PORTA=0X00;
 PORTC=0X00;
 while(1)
 {
 int a= PINC;
 if(a == 0 )
 {
 PORTA=0x01;
 }
 else
 {
 PORTA=0x00;
 }
 }
 } 

14 comments on “Interface Switch With AVR

Leave a Reply

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