C Program
#include<avr/io.h>           //This is the header for AVR Microcontroller.
#include <util/delay.h>    //header file to generate time delay.
int main(void)
{ 
 DDRB=0x0F;
 DDRC=0X00;             //sensor initilization
 while(1)
 {
 if((PINC&0x01)==0x00)        //checking sensor getting obstacle or not
 {
     PORTB=0x00;
              //Switch on all 4 LEDs
                             //Delay of 1sec=1000msec
 }
    else
    {
  PORTB=0xFF;
     }
  }
 


 
 
No comments:
Post a Comment