About arduino sketch main function
What is the relationship about hardware\arduino\cores\arduino\main.cpp and the MyMainDefaut.cpp?
We implement our own main()-method overriding the default arduino-one.
This allows us to do all the MySensors processing automatically.
Yeah,But why you can override the main()-method? in a project,The main() should not be the only one? I didn't understand the principle of internal ^_^ Looking forward to your reply!
You mean how this is possible?
loop()/setup()/main are so called weak functions (
__attribute__ (weak)) which makes them overridable. We take advantage of this to simplify things for the sketch developer.
I search the MySensor project,the loop()/lsetup() is weak functions (attribute (weak)) ,but the main is not clear.
@Magic-W it is the Arduino project that has the attribute, making it possible for other projects (such as MySensors) or a sketch developer to override.