Serial Monitor

I am making a morse code majig that lights up a led in the morse code version of waht you typed in the serial monitor but I have no idea how to make the serial monitor use a and b or any combination of letters here is my code

int led = 13;

void doDot() {
  digitalWrite(led, 1);
  delay(300);
  digitalWrite(led, 0);
  }

void doDash() {
  digitalWrite(led, 1);
  delay(900);
  digitalWrite(led, 0);
}
void space() {
  delay(900);
}


void setup() {
  pinMode(led, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    int idk = Serial.read();

    switch(idk) {
      case 'a': doDash(); break;
      case 'b': doDot(); break;
    }
  }
}

please help

Look at serial basics in the tutorials linked in the stickies at the top of this section

Just type ab in the serial monitor and click send? I probably don’t understand the problem.

Note that you might want to change the line-ending settings in Serial Monitor so it does not send and or .

a simple way to convert a character to a morse code pattern is to use a lookup table, e.g.

// structure with character and associated mode code
struct code {
    char ch;
    char *code;
};

// table with character and associated more code
struct code table[]= {
                {'A' , ".-"},
                {'B' , "-..."},
                {'C' , "-.-."},
                {'D' , "-.."},
...
                {'7' , "--..."},
                {'8' , "---.."},
                {'9' , "----."},
            };

in reading a character you look it up in table.ch and the associated table.code gives you the morse code which you can then output as a pattern of . and -