Thursday 2 April 2015

C/C++ make over in Arduino code

I am neither experienced in Arduino Programming and c language... but i am trying to learn both.
Arduino code is based on the c/c++ language..
anyone who knows simple basics of c language may wonder where the main() entry point function gone?
actually it's there it is hidden under the covers by the Arduino Build environment.
these covers make Arduino an Very easy Language to learn and once you know Arduino it is very hard to learn/program any other controller using C

now i am actually facing the same problem.

the Build process creates an intermediate file that includes the sketch code and the following additional statements.


int main(void)
{
init();
setup();
for(;;)
loop();
return 0;
}


the first thing that happens is a call to an init() function that initializes the Arduino hardware.
next setup() function is called. finally the loop() function is called over and over.
because the loop never terminates, the return statement never executed.

No comments:

Post a Comment