void Setup()... Loop() but exist others first...

Hello

Few months ago I found a topic here about some hide voids...
Now I can't found it...

Before Setup() and Loop() exist 2, 3 hide voids...

If somebody know some about them, please let me know.

Thanks on advance
Best regards
Pedro Ferrer

Few months ago I found a topic here about some hide voids...

void is a function return type, not some kind of object on its own.

Can you clarify what you are asking about?

Hello Paul

Thanks by your reply.
As I remember, exist some procedures, voids... something, that starts first than Setup and Loop voids...

Thanks on advance
Best regards
Pedro Ferrer

As I remember, exist some procedures, voids... something, that starts first than Setup and Loop voids...

What did the 'void something' suppose to accomblish? That could just be any user written function that could perform any possible operation, so that's not likely to gain you a answer that might be useful.

Lefty

Hello retrolefty

Thanks by your reply.
Something… as something else… isn’t a name of any void… :slight_smile:

Thanks on advance
Best regards
Pedro Ferrer

Maybe you were referring to the main() that is not shown in arduino IDE but is later patched to the code? It has no importance to most projects. All it does it to call setup and loop the loop.

Are you thinking of the 'main' function, that runs before 'setup' and 'loop'? In fact, 'main' calls 'setup' once and then repeatedly calls 'loop'.

Are you talking about the massaged cpp program that the IDE sends to the complier? IIRC, it's something like:

int main()
{
init();
setup();
while(1)
  loop();
}

Edit: beaten by 6s

Hello wildbill

wildbill:

int main()

{
init();
setup();
while(1)
  loop();
}

Perhaps is that!
So...

Can I edit 'int main' ?
I'm asking because I wonder if I can change PWM values... since by defaut PWM is 255... using 'int main' I can change to '0' before Arduino 'starts' really?
I'll explain better. I'm using a relay to avoid led flashing. Others use a Mosfet to do the same... because some drivers with PWM 255 means 100% of power...
Change 'int main' avoid the relay and mosfet ?

Please let me know
Thanks on advance
Best regards

Why not put something in setup()?

Hello liudr

liudr:
Why not put something in setup()?

On that moment a flashing already occurred... i suppose...

Best regards
Pedro Ferrer

What flashing? Until you tell it to, the pins are all inputs. Perhaps post your code?

If the PWM floating on startup is being seen as a high, you can add a 10K pulldown resistor from the PWM pin to ground, then the pin will stay low until your sketch starts up & programs it as an output ...