for statement as a timer
hi,
my statement not working. suppose loop time delay , while looping check see if sensor on irpin goes low. problem won't loop delay keeps breaking out of for. helpful.
randy
for (int i=0; <= 5000; i++) { // timer loop break out if irpin 5 goes low
sens = digitalread(irpin);
if (sens == 0)
{
break;
} // bail out on sensor detect
}
my statement not working. suppose loop time delay , while looping check see if sensor on irpin goes low. problem won't loop delay keeps breaking out of for. helpful.
randy
for (int i=0; <= 5000; i++) { // timer loop break out if irpin 5 goes low
sens = digitalread(irpin);
if (sens == 0)
{
break;
} // bail out on sensor detect
}
don't know how of delay expect, 5000 iterations won't take long execute - a small fraction of second, small amount of code that's executed in yours.
-j
-j
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > for statement as a timer
arduino
Comments
Post a Comment