In this project I tried to make a Morse code transmitter with light signal. It was for a University project and I will make the receiver in the next time.
DemoYou only need one LED but I suggest that use at least 3 different color. One of them is for the main message (I mean dot and dash) the other is for the delay to separate the dot and dash to recognize the letters and the last one is for the delay to separate the words.
The syntax for Arduino for example for letter A : .`- or X : -`.`.`-
Translate method in C#:List<string> MorseSting = new List<string>();
private string MorseToSend;
private string MorseToShow;
private string MorseToReady;
void Translate()
{
char[] characters = Msg.Text.ToCharArray();
for (int i = 0; i < characters.Length; i++)
{
Console.WriteLine(characters[i]);
}
for (int i = 0; i < characters.Length; i++)
{
if (characters[i] == 'a' || characters[i] == 'A') { MorseSting.Add(".`-`s`"); }
if (characters[i] == 'b' || characters[i] == 'B') { MorseSting.Add("-`.`.`.`s`"); }
if (characters[i] == 'c' || characters[i] == 'C') { MorseSting.Add("-`.`-`.`s`"); }
if (characters[i] == 'd' || characters[i] == 'D') { MorseSting.Add("-`.`.`s`"); }
if (characters[i] == 'e' || characters[i] == 'E') { MorseSting.Add(".`s`"); }
if (characters[i] == 'f' || characters[i] == 'F') { MorseSting.Add(".`.`-`.`s`"); }
if (characters[i] == 'g' || characters[i] == 'G') { MorseSting.Add("-`-`.`s`"); }
if (characters[i] == 'h' || characters[i] == 'H') { MorseSting.Add(".`.`.`.`s`"); }
if (characters[i] == 'i' || characters[i] == 'I') { MorseSting.Add(".`.`s`"); }
if (characters[i] == 'j' || characters[i] == 'J') { MorseSting.Add(".`-`-`-`s`"); }
if (characters[i] == 'k' || characters[i] == 'K') { MorseSting.Add("-`.`-`s`"); }
if (characters[i] == 'l' || characters[i] == 'L') { MorseSting.Add(".`-`.`.`s`"); }
if (characters[i] == 'm' || characters[i] == 'M') { MorseSting.Add("-`-`s`"); }
if (characters[i] == 'n' || characters[i] == 'N') { MorseSting.Add("-`.`s`"); }
if (characters[i] == 'o' || characters[i] == 'O') { MorseSting.Add("-`-`-`s`"); }
if (characters[i] == 'p' || characters[i] == 'P') { MorseSting.Add(".`-`-`.`s`"); }
if (characters[i] == 'q' || characters[i] == 'Q') { MorseSting.Add("-`-`.`-`s`"); }
if (characters[i] == 'r' || characters[i] == 'R') { MorseSting.Add(".`-`.`s`"); }
if (characters[i] == 's' || characters[i] == 'S') { MorseSting.Add(".`.`.`s`"); }
if (characters[i] == 't' || characters[i] == 'T') { MorseSting.Add("-`s`"); }
if (characters[i] == 'u' || characters[i] == 'U') { MorseSting.Add(".`.`-`s`"); }
if (characters[i] == 'v' || characters[i] == 'V') { MorseSting.Add(".`.`.`-`s`"); }
if (characters[i] == 'w' || characters[i] == 'W') { MorseSting.Add(".`-`-`s`"); }
if (characters[i] == 'x' || characters[i] == 'X') { MorseSting.Add("-`.`.`-`s`"); }
if (characters[i] == 'y' || characters[i] == 'Y') { MorseSting.Add("-`.`-`-`s`"); }
if (characters[i] == 'z' || characters[i] == 'Z') { MorseSting.Add("-`-`.`.`s`"); }
if (characters[i] == '1') { MorseSting.Add(".`-`-`-`-`s`"); }
if (characters[i] == '2') { MorseSting.Add(".`.`-`-`-`s`"); }
if (characters[i] == '3') { MorseSting.Add(".`.`.`-`-`s`"); }
if (characters[i] == '4') { MorseSting.Add(".`.`.`.`-`s`"); }
if (characters[i] == '5') { MorseSting.Add(".`.`.`.`.`s`"); }
if (characters[i] == '6') { MorseSting.Add("-`.`.`.`.`s`"); }
if (characters[i] == '7') { MorseSting.Add("-`-`.`.`.`s`"); }
if (characters[i] == '8') { MorseSting.Add("-`-`-`.`.`s`"); }
if (characters[i] == '9') { MorseSting.Add("-`-`-`-`.`s`"); }
if (characters[i] == '0') { MorseSting.Add("-`-`-`-`-`s`"); }
if (characters[i] == ' ') { MorseSting.Add("/`"); }
}
for (int i = 0; i < characters.Length; i++)
{
MorseToSend += MorseSting[i];
}
MorseToSend += "/";
MorseToReady = MorseToSend.Replace("`", "");
MorseToShow = MorseToReady.Replace("s", " ");
Morse.Text = MorseToShow;
}
You can download the WinForm application below.
IF YOU HAVE ANY PROBLEM WITH THE PROJECT YOU CAN BE IN TOUCH WITH ME.
Comments