ok so i am new to programming but have a lot of exp in hobby electronics after doing some practice in arduino (led cube,led sequences,rgb led,motor control,ir sensors etc)
i finally started doing a serious project , in this project i hav 2 (IR)sensors which give ground on there output pin when triggered, i want to make a program which will check the status of both sensors,
when the first sensor is triggered giving a negative pulse to a pin and after a short delay the second sensor is triggered giving a negative pulse to another pin, a led should light up. similarly when the second sensor is triggered before the first ,the led should turn off .for this i used the following code {extract from the main code}
if(digitalRead(sensorA)==LOW)
{
delay(10);
if(digitalRead(sensorB)==LOW)
{
count=count+1;
}
}
if(digitalRead(sensorB)==LOW)
{
delay(10);
if(digitalRead(sensorA)==LOW)
{
count=count-1;
}
}
if(count<0)
{
digitalWrite(output,LOW);}
if(count>0)
{digitalWrite(output,HIGH);}
but the value of count remains zero whatever i do,i hav tried various alterations to this code but nothing works
the name of my project is smart light switch( senses no of ppl in room and controls room lighting) and i am using a breadboard arduino and println function just hangs up my pc
this is my first post so sorry if i made a mistake just tell me and i will correct it