Microcontroller › 8051 › LASER SECURITY › first make alarm=0then when
April 5, 2014 at 1:30 pm
#11471
Ashutosh Bhatt
Participant
first make alarm=0
then when ur ldr becomes 0 – make it alarm = 1.
dont make alarm = 0 aferwards
when anyone presses manual reset the alarm will be 0 again
#include<reg51.h>
sbit alram=P2^2;
sbit ldr =P3^2;
void delay (unsigned char msec)
{
unsigned int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void main(void)
{
alarm = 0
while(ldr==1);
//if(ldr==1)
//{
//alram=0;
//}
//else
//{
alram=1;
delay(2000);
//}
}