some codes has #include <Arduino.h>
what the purpose of this library
is that part of Arduino built in or special library to download
It is part of the IDE. It is the magical include for all the arduino specific stuff and the AVR stuff, too.
For an application / program to be recognized by an operating system it HAS to have "main" function.
To get better answer to your question check the attached link.
Short answer - yes Arduino.h header file is ALWAYS there because it contains the supporting info the rest of the "main" needs to function.
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/main.cpp
The gist of main.cpp
#include <Arduino.h>
//Declared weak in Arduino.h to allow user redefinitions.
int atexit(void (*func)()) { return 0; }
// Weak empty variant initialization function.
// May be redefined by variant files.
void initVariant() __attribute__((weak));
void initVariant() { }
int main(void)
{
init();
initVariant();
#if defined(USBCON)
USBDevice.attach();
#endif
setup();
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
return 0;
}
1 Like
Another reason for including arduino.h is to get all the #DEFINES for the B000000 nonsense and stuff like INPUT_PULLUP
1 Like