Exercises

  • Morse code not only supports letters and digits, but it also defines symbols such as commas. Improve the Telegraph class so that it understands all characters of the Morse code.

  • Blinking LEDs are great, but when we think of Morse code, we usually think of beeping sounds, so replace the LED with a piezo speaker, which is cheap and easy to use. The following figure shows how you connect it to an Arduino. Piezo speakers have a ground pin and a signal pin, so connect the speaker’s ground to the Arduino’s ground, and connect the signal pin to Arduino pin 13.

    images/arduino_with_speaker.jpg

    Then replace the output_symbol method with the following code:

     
    void​ Telegraph::output_symbol(​ ...

Get Arduino: A Quick-Start Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.