LED blinking project with STM32
Hardwares : STM32F103C8Tx , ST-LinkV2
In the Project Manager section, only theproject is given a name, STM32CubeID is selected as the Toolchain/IDE. After this step go to the Code Generator section on the left side and select second option from the top " Copy only the necessary library files ". Now it will generate the code when saved with CTRL+S keys. Or you can also generate the code using the " Device Configuration Tool Code Generation " button with a yellow icon in the upper-left menu bar.Now our main.c file will be formed. We'll write several codes here :
We will write the code that will allow our led to blink with a delay in the while loop located under the MX_GPIO_Init() expression as follows:
{
HAL_Delay(100);
HAL_GPIO_TogglePin(LED_GPIO_Port,LED_Pin);
}
Now, if we save our project again and say Debug from the menu bar at the top (click on the green bug icon), the design of the menu bar will change. Finally, if we press F8, we will see that the led starts flashing. By giving different values than 100 to the value of our Delay function above and Debugging it, we can observe how the led flashing speed changes.
Sources :
https://freeelectron.ro/installing-st-link-v2-to-flash-stm32-targets-on-linux/
https://kodmek.com/keil-uvision-kullanarak-stm32f103c8-programlama.html
Comments
Post a Comment