Wtite a program for relay.


#include
#define relay P0_0
#define key1 P2_0

void delay(unsigned int i);

void main (void)
{
unsigned char x=0;

while(1)
{
if(key1==0)
{
relay=1;
}
else
{

relay=0;
}
}

}
 void delay(unsigned int i)
{
  while(i!=0)
  {
  i–;
  }
  }

Add Comment