Blinking Light Program
Introduction
Implement a simple blinking light program to start your STM32 journey.
Hardware
STM32F103C8T6
core board
Pin PC13
conducts at low level.
Software
Configure GPIO
Select GPIO_Output, remember to generate the code.
Compile
Download
Run flash.bat to download the program
.\flash.bat
At this point, the green LED corresponding to PC13 should light up.
Edit the Core/Src/main.c File
Add the following code before the /* USER CODE END WHILE */ line:
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET); // Set PC13 high
HAL_Delay(500);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET); // Set PC13 low
HAL_Delay(500);
Compile & Download
The blinking light program is now complete. Isn’t it simple?
Conclusion
This article has shown you how to implement a blinking light program. Everything complex starts from something simple. Keep it up!
Copyright Notice: Free to Share - Non-commercial - No Derivatives - Keep Author - Keep Source
Author: afxcn
Source: https://gostartkit.com/docs/stm32/flashing-light
Date: June 18, 2025