Share us



RSS feeds

Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on/off LED by buttonPrint

This is another continue of STM32 tutorial (STM32F746 tutorial). I would like to show example code for turn on/off LED with button.
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

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.