Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on/off LED by button
- December 05 2015
- STM32F4, STM32F7, STM32L1, STM32F3, Nucleo, Discovery
- 9446 Reads
- 0 Comments
This example code is able to use for another microcontrollers by ST as STM32L100, L152, STM32F103, F407 and more.
LED is connected to PORT I, GPIO 1. Button is connected to PORT I, GPIO 11.
Other tutorials with STM32F7:
Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on/off LED by button
Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on LED (controlling GPIO)
STM32F746 discovery and AC6 (System Workbench for STM32)
How to begin with STM32 and why - tutorial
Button pinout is showed on these pictures:
The example code will be describe with comments.
main.h
main.c
Be careful if you have LED and BUTTON on same PORT. Don't reset peripheral again.
You can use this code for setting of OSPEEDR of PORT.
If you have LED on another PORT then BUTTON, you shall enable both peripherals (I mean enable e.g. PORTx and PORTy)
Project by AC6 System Workbench for STM32 is here.
Other tutorials with STM32F7:
Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on/off LED by button
Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on LED (controlling GPIO)
STM32F746 discovery and AC6 (System Workbench for STM32)
How to begin with STM32 and why - tutorial