Moving #include lines to the beginning of the sketch breaks libraries that
need the main sketch to #define things before they are included. This uses
the preprocessing strategy from upstream Arduino (actually from Processing)
to inject the Arduino.h header include line and the extracted prototype
lines after all initial preprocessor directives and before the first
non-preprocesser statement.
Moving #include lines to the beginning of the sketch breaks libraries that need the main sketch to #define things before they are included. This uses the preprocessing strategy from upstream Arduino (actually from Processing) to inject the Arduino.h header include line and the extracted prototype lines after all initial preprocessor directives and before the first non-preprocesser statement.