Pages: [1]   Go Down
Author Topic: Where does "Serial" get defined in the Arduino environment  (Read 314 times)
0 Members and 1 Guest are viewing this topic.
Munich
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Munich
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: