Wednesday 30 September 2015

single button for led on/off


        single button for led on/off


One micro button for turn on the LED and turn OFF the LED. it is very simple and the code.
  1. atmega 16 microcontroller
  2. micro button
  3. 3v LED
  4. 5v supply

softwares

  1. atmel studio
  2. extreme burner
This technic was used in most of all electronics devices. so it was usefull for all electronics students and starters.  when we press a button tle led was turn one then again pressthe button LED turn off. In this project I used led. But it is work all electronic output devices like motor, home lights,and more.


PROGRAMME
/*
 * switch_or.c
 *
 * Created: 10/3/2015 2:43:36 PM
 *  Author: suriasarath
 */


#include <avr/io.h>
#include <util/delay.h>
    int val1;

int main(void)
{
    DDRA=0xff;
    while(1)
    {
        val1=PINB;
        if (val1==0xfe)
        {
            PORTA ^= (1 << 0);
            _delay_ms(1000);
        }
      
    }
}

Tt is very simple code................... 

No comments:

Post a Comment