Go Down

Topic: arduino has main function...??? (Read 2 times) previous topic - next topic

ambuj

hi all,
        i have arduino mega 2560 development kit. i m new for this hardware. i want to know when we programming in arduino ,so can we define a function which name is main like 8051 or other controllers.
coz in this i saw the loop & setup functions... so my questions is. can we have permission to access in to main function coz without main function "C" code doesn't work.

if we can access to main function then plz anyone give a code like this format.

PaulS

When you compile a sketch, a main() function is created. The init() and setup() functions are called, and then loop() is called in an endless loop.

What is it that you want to do in main() that can not fit in setup() or loop()?

AWOL

Yes, there is a "main", but it isn't clear to me why you need access to it.
Code: [Select]
int main(void)
{
init();

setup();
   
for (;;)
loop();
       
return 0;
}


You provide "setup" and "loop".
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

ambuj

Thanks to all  for your support ....

actually when i start, so i had an query that why i asked this.

Go Up