array lookup with variable for morse code

I’m trying to translate morse code to blink the LED - I’m using an uno, and i’m stuck here.

code:

char bleb = Serial.read(); //get letter
void dit() { //short
  digitalWrite(LED_BUILTIN, HIGH);   
  delay(300);                       
  digitalWrite(LED_BUILTIN, LOW);   //how to blink
  delay(300);                       

  }
void dah() { //long
   digitalWrite(LED_BUILTIN, HIGH);   
  delay(900);                       
  digitalWrite(LED_BUILTIN, LOW);    
  delay(300); 
  }
  
void exec(){
char ex = bleb;

  for (int i = 0; i < 5; i = i + 1) { 

    if (ex[i] = 0){dit();} //loop through the letters' array
      else if (ex[i] = 1){dah();} //this doesnt work
  }
}

int a[] = {0,1}; //morse code for each letter
int b[] = {1,0,0,0};
int c[] = {1,0,1,0};
int d[] = {1,0,0};
int e[] = {0};
int f[] = {0,0,1,0};
int g[] = {1,1,0};
int h[] = {0,0,0,0};
int i[] = {0,0};
int j[] = {0,1,1,1};
int k[] = {1,0,1};
int l[] = {0,1,0,0};
int m[] = {1,1};
int n[] = {1,0};
int o[] = {1,1,1};
int p[] = {0,1,1,0};
int q[] = {1,1,0,1};
int r[] = {0,1,0};
int s[] = {0,0,0};
int t[] = {1};
int u[] = {0,0,1};
int v[] = {0,0,0,1};
int w[] = {0,1,1};
int x[] = {1,0,0,1};
int y[] = {1,0,1,1};
int z[] = {1,1,0};




void setup() {

Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);

}

void loop() {

digitalWrite(LED_BUILTIN, LOW); 
exec();
}

and here’s the error message:

morse:21:13: error: invalid types 'char[int]' for array subscript
     if (ex[i] = 0){dit();} //loop through the letters' array
             ^
morse:22:20: error: invalid types 'char[int]' for array subscript
       else if (ex[i] = 1){dah();}
                    ^
exit status 1
invalid types 'char[int]' for array subscript

apparently you can’t use a variable as the name of an array to find it.
Could you kind folks tell me what I’m doing wrong here?

if (ex[i] = 1)

how do you do comparisons?

The compiler is telling you that “ex” is not an array, so any references to it should not have a subscript.

char bleb = Serial.read(); //get letter

This needs to be in a function.

You’re missing a layer of indirection - you need to lookup the pattern for the letter you read from the serial port.