Thanks for this i can get it to start the loop but it wont switch to the other loop when the other button is pressed
model 2 does. Did you implement the 3 models and compared their behaviour?
You can also implement a state machine which holds a variable telling which loop to run, that is affected by the buttons pressed.
int whichLoop = 0;
void loop()
{
// CHECK THE BUTTONS
whichLoop = 0;
if (digitalRead(PIN_A) == HIGH) whichLoop = 1;
if (digitalRead(PIN_B) == HIGH) whichLoop = 2;
if (digitalRead(PIN_C) == HIGH) whichLoop = 3;
// SELECT THE LOOP
switch(whichLoop)
{
case 1: loopA(); break;
case 2: loopB(); break;
case 3: loopC(); break;
default: break;
}
}
void loopA()
{
// do you A thingie
}
void loopB()
{
// do your B thingie
}
void loopC()
{
// do your C thingie
}