Introducing the MorseEncoder library, a tool that converts various data types to Morse codes, including integers, longs, characters, character arrays, and strings. it can be encoded as AUDIO or LIGHT by your choice.
- Go to the
Releases
Page and download the latest version. - Use the Arduino Library Manager to install MorseEncoder.
Sketch -> Include Library -> Add .ZIP Library...
Also, you can install the library directly from the Library Manager in the IDE.
Sketch -> Include Library -> Library Manger... -> Search for - MorseEncoder
#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] Broadcast encoded audio
delay(2000);
morseL.print(message); // [LIGHT] Broadcast encoded light
delay(2000);
}
or you can navigate to the Examples section of the Arduino IDE and find the example code there!
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate. and a big thanks goes to the dev friends in this Arduino Forum