Go Down

Topic: Where does "Serial" get defined in the Arduino environment (Read 365 times) previous topic - next topic

codinghead

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:

Serial.begin(115200);

without first having to have written:

HardwareSerial Serial;

in my sketch?

Many thanks in advance for any support on this! Stuart

PaulS

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

codinghead

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

Go Up