Posted on July 26, 2008 at 1:25 pm

Arduino morse library

 

I should point out that this was me trying to see how much I could milk the "blink" tutorials while I was at work, as taking a soldering iron to work would raise eyebrows ;)

It turns out there are issues with the result, with some timing issues that make the resultant morse unsuitable for realworld use. It also turns out that using timer() rather hardware timers is entirely blocking, so this doesn’t play well with others.

I’m working on it :)

So I’m just chuffed I’ve gone from hello world to libraries this morning.   Nothing complicated, but tedious.

A couple of examples:

#include <Morse.h>
Morse morse(13,5); // pin, wpm
void setup() {}

void loop() {
    morse.send("CQ World K");
    delay(5000);
}

And just a tiny bit more involved, serial in, morse out.

#include <Morse.h>
Morse morse(13,30);
char letter;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
    if (Serial.available())
    {
        letter = Serial.read();
        morse.letter(letter);
    }
}

Download: libmorse-0.1.zip (11k)

Leave a Reply