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  

}

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


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > for statement as a timer


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums