I'm using the Arduino software to create a Morse code decoder using the serial monitor.
I enter a Morse code such as .-
as a text string and it's displayed in the LCD as a alphanumeric text. So if I enter .-
into the serial Monitor, A
is displayed on the LCD. But it only works for single symbols, not the dot and dash together.
Is there a way to make the if statement as seen below accept both the dots and dashes together?
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
Serial.begin(9600);
}
void loop()
{
char schar;
if (Serial.available())
{
schar = Serial.read();
Serial.write(schar);
if (schar== '.-' ){
Serial.write('A');
lcd.print('a');
}
}
}