Reading through HardwareSerial Arduino library, I've noticed that in order to use Serial.begin, Serial.write etc, one must first initialize Serial object, which seems to take a lot of arguments. Now, when does that happen? Also, when I press compile in Arduino IDE, how does the IDE know where to find those Serial functions?
Now, when does that happen?
At the bottom on the .cpp file you were reading.
PaulS:
Now, when does that happen?
At the bottom on the .cpp file you were reading.
That was embarrassing. Didn't notice that at all. However, I'm still wondering where and when does Arduino include that library, and how does it make available to both your sketch and user-included libraries, such as MIDI etc.
However, I'm still wondering where and when does Arduino include that library
In Arduino.h:
#ifdef __cplusplus
#include "WCharacter.h"
#include "WString.h"
#include "HardwareSerial.h"
Arduino.h is added to every .ino file as part of the conversion to a .cpp file that can be compiled.
Any library needs to include Arduino.h, too.
Thanks a lot!