GPIO
Last updated
Last updated
On the STM32F446RET6 Nucleo board, the LD2 LED is connected to PA5, and the USER Button is connected to PC13.
Note: the LED is active high.
We will demonstrate how to set up a generic GPIO output pin with the LED, and a generic GPIO input pin with the user button.
First, set the configuration from the Starter Project.
Click on PA5, set it to "GPIO_Output".
Click on PC13, set it to "GPIO_Input".
Save the .ioc file and generate code.
First, add the code from the Starter Project.
In main.c
, add the following code
After saving, upload the code
We can see LED LD2 blinking, and when we press/release the USER Button, the serial output changes.