C array of strings to a function
<p>I'm trying to make a program that shows the morse code of the alphabet (A-Z) on my STM32 F091 microcontroller using a LED on the board.</p>

<p>So I made an array with all the posibility's (K = Short, L = Long)</p>

<pre><code>char *Morse[26] = {"KL", "LKKK", "LKLK", "LKK", "K", "KKLK", "LLK", "KKKK", "KK", "KLLL", "LKL", "KLKK", "LL", "LK", "LLL", "KLLK", "LLKL", "KLK", "KKK", "L", "KKL", "KKKL", "KLL", "LKKL", "LKLL", "LLKK"};
</code></pre>

<p>Now my question is if I use this pointer in a function I only get the first character of the string in my array. For example I get only "K" from "KL". </p>

<p>How do I get the full string? I know it is possible to print out the full string using %s but how do I pass this to a function?</p>

<p>What I exactly want is the following output (shown at the bottom).
And then check with my microcontroller if the character is "K" (Short) than the LED lights up for a short time, When the charachter is "L" (Long) the LED will light up for a longer time.</p>

<pre><code>A: KL 
B: LKKK 
C: LKLK 
D: LKK
E: K
F: KKLK
G: LLK
H: KKKK
I: KK
J: KLLL
K: LKL
L: KLKK
M: LL
N: LK
O: LLL
P: KLLK
Q: LLKL
R: KLK
S: KKK
T: L
U: KKL
V: KKKL
W: KLL
X: LKKL
Y: LKLL
Z: LLKK
</code></pre>

<p>Example</p>

<pre><code>int main(void)
{
     while (1)
      {
      /* USER CODE END WHILE */

      /* USER CODE BEGIN 3 */
        for(char alphabet = 'A'; alphabet &lt;= 'Z';alphabet++)
        {
            Morsecode(alphabet);
            CharToLeds(*Morse[i]);
            i++;
        }
}

void Morsecode(char ch)
{
        if(j == 26)
        {
            j = 0;
        }
        printf("\r\n %c: %s", ch ,Morse[j]);
        HAL_Delay(1000);
        j++;
}
void CharToLeds(char data)
{
    if(data == 'K')
    {
        HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET);
        HAL_Delay(1000);
        HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_RESET);
    }
    if (data == 'L')
    {
        HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET);
        HAL_Delay(3000);
        HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_RESET);
    }
}   
</code></pre>

<p>Thanks in advance</p>