For loops in setup

Hi there

Apologies if this is not the best place to post. I'm very new to arduino. I was wondering if you can run a for loop in the setup? I tried the blinking exercise flashing a laser module at 50 milliseconds for 5 times. I then put a 1000 milliseconds loop in the loop section.

I wanted to see if the laser flashed and then went into the blink as per the loop. Instead the laser kept fashing (ie the for loop from setup seems to keep going).

Am i right to think that this is because functions initiated in setup continue through the loop? My thinking was that code executed in the setup ran once a cd then stopped.

Many thanks in advance.

Process_Driven:
Am i right to think that this is because functions initiated in setup continue through the loop? My thinking was that code executed in the setup ran once a cd then stopped.

your thinking was correct.

are you going to reveal the code with the mysterious persistent function?

Process_Driven:
Hi there

Apologies if this is not the best place to post. I'm very new to arduino. I was wondering if you can run a for loop in the setup? I tried the blinking exercise flashing a laser module at 50 milliseconds for 5 times. I then put a 1000 milliseconds loop in the loop section.

I wanted to see if the laser flashed and then went into the blink as per the loop. Instead the laser kept fashing (ie the for loop from setup seems to keep going).

Am i right to think that this is because functions initiated in setup continue through the loop? My thinking was that code executed in the setup ran once a cd then stopped.

Many thanks in advance.

Post your sketch, its hopeless trying to debug a program from a vague description in English!!

setup() and loop() and just functions like any other, there is nothing whatsoever special about them except
that they are called from main() for you - something like

void main()
{
  setup();
  while (true)
    loop();
}

(You can go find main.cpp in the sources if you want, its a little more involved than that).