Write a program to glow 8 LEDs and after 1 second all the LEDs should be turned off when the switch is pressed and it should be repeated infinitely.


#include<8051.h>
void delay(unsigned int i)
{
while(i!=0)
{
i–;
}
}
void main()
{
while(1)
{
if(P0_0==0)
{
P1=0x00;
delay(50000);
P1=0xff;
delay(50000);
}
}
}

Add Comment