Go Down

Topic: void Setup()... Loop() but exist others first... (Read 963 times) previous topic - next topic

Pedro Ferrer

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

PaulS

Quote
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?

Pedro Ferrer

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

retrolefty

Quote
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



Pedro Ferrer

Hello retrolefty

Thanks by your reply.
Something... as something else... isn't a name of any void... :)

Thanks on advance
Best regards
Pedro Ferrer

liudr

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.

Anachrocomputer

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

wildbill

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

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


Edit: beaten by 6s

Pedro Ferrer

Hello wildbill


Code: [Select]

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

liudr


Pedro Ferrer

Hello liudr


Why not put something in setup()?


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

Best regards
Pedro Ferrer

Nick Gammon


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


What flashing? Until you tell it to, the pins are all inputs. Perhaps post your code?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

CrossRoads

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  ...
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up