Interrupt Cancel Button


i'm making arduino application has multiple separate programs.  there 7 leds light when respective program running.  there 3 tactile switches make kind of interface navigating between programs.  when press left button, arduino executes previous program, etc.

my problem when each program running, of time, arduino standing by, waiting delay(); finish.  when that's happening, want listening 'cancel program button.'  when that's pressed, user can navigate between programs again.  how write code stop delay(); , leave arduino open more processing?

you can write own implementation of delay() function uses 1 in wiring.c part of code starting point:
code: [select]
void delay(unsigned long ms)
{
     unsigned long start = millis();
     
     while (millis() - start <= ms) {
           // code starts here
              if (buttonpressed()) return;
              // code ends
       }
}


Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > Interrupt Cancel Button


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