public:
void output_symbol(const int length) {
// ...
}
};
class Speaker : public OutputDevice {
public:
void output_symbol(const int length) {
// ...
}
};
You can then use these classes as follows:
Led led;
Speaker speaker;
OutputDevice* led_device = &led;
OutputDevice* speaker_device = &speaker;
led_device->output_symbol(200);
speaker_device->output_symbol(200);
The rest is up to you.
• Try to learn Morse code. Let someone else type some messages into the
serial terminal and try to recognize what that person sent. This isn’t
necessary for learning Arduino development, but it’s a lot of fun!
report erratum • discuss
Exercises • 75
www.it-ebooks.info