KennethPaul Rodolf P. Castor
Published

RT-Spark LED Blink

A simple Blinking LED based on SOS Morse Code that is ran through an RT-Spark, with a built-in "STM32F407ZGT6" Microcontroller chip.

BeginnerProtip48
RT-Spark LED Blink

Things used in this project

Hardware components

USB to TYPE C
×1
RT-Spark STM32F407 Development Board
×1

Software apps and online services

RT-Thread STM32CUBEIDE
RT-Thread STM32CUBEMX

Story

Read more

Schematics

STM32F407ZGT6 Pins

For reference of the STM32F407ZGT6 Microcontroller pins.

Code

SOS Blinking Pattern Code

C/C++
The logic to create the pattern, must be inserted within the main(void) function from main.c file
int morseS = 0, morseO = 0;

HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_12);  // Toggle Red LED
HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_11);  // Toggle Red LED

while (1)
{
  HAL_Delay(1000);
  while(morseS < 6) {
	  HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_12);  // Toggle Red LED
	  HAL_Delay(250);
	  morseS++;
  }

  morseS = 0;
  HAL_Delay(100);

  while(morseO < 6) {
	  HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_11);  // Toggle Red LED
	  HAL_Delay(500);
	  morseO++;
  }

  morseO = 0;

  while(morseS < 6) {
	  HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_12);  // Toggle Red LED
	  HAL_Delay(250);
	  morseS++;
  }

  morseS = 0;
}

Credits

Kenneth
1 project • 0 followers
Paul Rodolf P. Castor
16 projects • 8 followers

Comments