From charlesreid1

This is a little more information on the W5OBM Morse library, from the Arduino Ham Radio book.



To install the W5OBM Morse library, download the directory containing the C code for the Morse library (link to the code).

Making a Zip File

Create a zip file from this directory, which will be called will contain a folder called Morse/

The folder Morse will contain a file called Morse.h

Loading Library in Arduino

Now you can load the library into Arduino using the zip file you've just created.

Open the Arduino Development Environment, and pick Sketch > Include Library > Add .ZIP Library


Navigate to the zip file and pick it. The menu and window should close.

Using the Library in Arduino

When you re-open the Sketch > Include Library menu, you should see the library you added at the very bottom.


Picking the Pin

When using the Morse Library, you have to pick which pin you're using. Make sure you pick a pin where pulse width modulation (PWM) is enabled. The Morse library uses PWM to send the sound signal through the speaker, which makes the sound less harsh and annoying. But it means you have to make sure and use a PWM enabled pin. On the Arudino Micro and Arduino Leonardo, these pins are 3, 5, 9, 10, 11, and 13 (as listed here). Check with the manufacturer for information if it isn't indicated on the board itself.

Morse Code Beep Circuit

See the Morse Code Beep Arduino Micro page for a simple circuit using the Arduino Micro to send out morse code beeps.

Example Sketch

There is an example sketch included with the Morse library, given below. It shows how to send morse code in two ways: first, by sending a string. Second, by sending characters representing specific letters. Here is the example:

// Author Erik Linder
// Released 2011 under GNU GPLv3
// Usage: morse( <pin number>, <speed WPM>, <1=beep, 0=PTT> )
//        sendmsg( "<text-to-send>" )

#include <Morse.h>

// Uncomment to beep a speaker at pin 9
Morse morse(9, 12, 1);

void setup()
  // Nothing here for the Morse lib

void loop()
  morse.sendmsg("HELLO WORLD!");
  delay (2000);
  delay (2000);