Separate loops with own delays

Ok so I would like a main loop which triggers (when conditions met) another loop with a delay in it, but I have 16 additional loops and I dont want any of these delays to interfere with the main loop. How please?

void setup()
int i = 1;

void loop()
i = analogRead(A0);
if (i ==1) {
if (i ==2) {

void dis1()
digitalWrite(1, HIGH);
digitalWrite(1, LOW);

void dis2()
digitalWrite(2, HIGH);
digitalWrite(2, LOW);

Use the BWD BlinkWithoutDelay technique.
There is an example in the IDE.

Putting int i = 1; in setup() then accessing i in loop() has i going out of scope.

Give us all the information if you want help.


Tell us what you want to happen not how you think it should work given what you think you know.

It is going to be really hard to get just a 1 or just a 2 from an analog input.

You can apply the principles in Demonstration code for several things at the same time.

+1 Sterretje, you should see how blink without delay works. It's very simple to understand. Then you can go to the link in #4.