Solved
STM32H755ZI-Q Small problem with Led not working as it should.
I'm trying to blink variation of morze code with specific string on yellow led, but the led just turns on and stays on for a little bit and then turns off.
When I try to debug it step by step it works as it should, but the moment I press run, it does the same think. If anyone can shed some light on this, I would really appreciate it!
Thank you!
char* name= "text";
char *string;
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
for(;*name!= '\0';name++) {
string = morze(*name);
for(int i = 0;string[i] != '\0';i++) {
HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_1);
if(string[i] == '.'){
HAL_Delay(500);
}else if(string[i] == '-') {
HAL_Delay(1000);
}else {
int a = 0;
}
HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_1);
}
}
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
char* morze(char a)
{
switch (a) {
case 'x':
return "-..-";
case 'e':
return ".";
case 't':
return "-";
default:
break;
}
return NULL;
}