Toggle programs

Hi, I know that I can only have one void loop, but how can I made a second? My program is long so I would like to be able to switch between programs.

Example program1 makes an led loop fading, then switch to program2 and the led loops flashing.

you can, but not when you are using delay()

this might be your interest

Have a look at how functions are used in Planning and Implementing a Program

...R

You can define 2 subprograms: the first one makes the led fade and the second makes it blink. Then your loop will call sub1 and sub2. If you want to stop at that point, you just have to add an inifinite loop, otherwise just do whatever you want after that.