DEV Community

Ashen Chathuranga
Ashen Chathuranga

Posted on • Edited on

MorseEncoder: Arduino Library for Encoding Data to Morse Code (Audio & Light)

Hi, My name is Ashen a software developer. I am always passionate about cryptography algorithms and microcontrollers. so I made something that combines two.
its a Library for Arduino called MorseEncoder and what it do is when you pass data to it its going to convert it to Morse code and broadcast it.
it supports various data types to Morse codes, including integers, longs, characters, character arrays, and strings.
its very well documented including installation guides in the repo and a example will look like this,

#include "MorseEncoder.h"

MorseEncoder morseA(9);       // Initialize with the desired pin for Audio **PWM pins only
MorseEncoder morseL(13);      // Initialize with the desired pin for Light

void setup() {
  morseA.beginAudio(15, 500); // [AUDIO] Initialize WPM (word per minute) rate and frequency
  morseL.beginLight(15);      // [LIGHT] Initialize WPM (word per minute) rate
}

void loop() {
  String message = "sos";
  morseA.print(message);   // [AUDIO] Boradcast encoded audio
  delay(2000);
  morseL.print(message);   // [LIGHT] Broadcast encoded light
  delay(2000);
}
Enter fullscreen mode Exit fullscreen mode

in that example I used both features and so you can easily understand how the library works.


Here is a little YouTube short video that ive made with my library, if you know what that Morse code says, comment down bellow ๐Ÿ˜‰

Top comments (0)