Is the .ino file an alternative from a main.cpp file?
If yes, then could someone mind explaining the structure of the .ino file in main.cpp and its relationship?
Is the .ino file an alternative from a main.cpp file?
If yes, then could someone mind explaining the structure of the .ino file in main.cpp and its relationship?
The Arduino uses the gcc compiler. That compiler wants a normal main function of course. Arduino has put a layer on top of that with setup and loop.
The hidden main function for basic Arduino boards is in main.cpp (click on it to see it).
You see that init is called, and setup and loop and a few other things.
To learn how to use setup and loop, you can try a few examples. They are in the menu of the Arduino IDE and they are also online.
The .ino files are all combined together and presented to the compiler as a single .cpp file to compile. The Arduino libraries are compiled from source as well, and everything is linked into a binary.
When you know how to use setup and loop, try the Blink Without Delay example. It can be used to run different software timers and do all kind of tasks and keep everything running smooth.