From charlesreid1

Morse Code on Arduino

Sending morse code on an Arduino is a little more tricky than you might think - at least when it comes to anything beyond the basics. For example, how do you take measurements from a sensor while simultaneously keying morse code? What about timing - how long do you wait between letters? words? dots? dashes?

In any case, I've looked into a couple of different morse code libraries for the Arduino, with a rundown of how to install and use each of them.


Arduinomorse Library

A guide to installing the Arduinomorse library from GitHub user Mark Fickett, which allows you to send morse code with the Arduino by including a header:

The Arduinomorse library has a fire-and-forget philosophy. You tell the keyer to transmit something, at a certain speed, and then you go off and do other things, like talk to your sensors. This can be good - if you're trying to do lots of things with a single sensor and you just want to send some morse code. But this can be bad if you want greater control over the speed of your morse code while it is transmitting.

In one of the projects below, I wanted to use a potentiometer to control the speed of a morse code keyer. Using the Arduinomorse library in this case was problematic, because it was not possible (as far as I could tell) to adjust the WPM of the transmission on-the-fly.

W5OBM's Morse Library

Morse Library

The website for W5OBM's Arduino Ham Radio book has a link to another morse code library, simply called Morse. This is one that the author obtained elsewhere and modified to send correct Morse code.

This library gives the Arduino finer-grained control over the morse code that it is sending while it is in the process of sending it - that is, sending morse code is a letter-by-letter process, not a string process. For a morse code keyer with a speed control knob, we need to have more interactive control over the sending speed, and that's what the Morse library does.