Where does "Serial" get defined in the Arduino environment

Dear All,

I am currently designing a library for Arduino and I am using the the “HardwareSerial” class as the model for my library.

Despite having searched through all the source code, I am still at a loss as to how “Serial” gets defined.

In the “HardwareSerial.h” there is:

extern HardwareSerial Serial;

This means, as far as I remember, that “Serial” gets defined elsewhere. I just can’t find where.

Looking at this another way, why can I write in my Arduino setup() function:


without first having to have written:

HardwareSerial Serial;

in my sketch?

Many thanks in advance for any support on this! Stuart

Close, oh, so close. Only off by three letters. Look at the bottom of HardwareSerial.cpp.

Brilliant! Thanks very much. Couldn't see the wood for the trees :o)