All right, now that we have our build environment set up and have tested our ability to download code to the target STM32F429 Discovery board, let's write a program that will actually do something.
In this case, we're going to write a program that will light the LED when the button is pressed, and extinguish the LED when the button is released. (Oooh! Exciting!) We're going to build the project a few different ways throughout this tutorial series to understand some of the capabilities of the STM32F429. The first method we're going to use is simple, straightforward, and horribly inefficient. It's called polling.
Basically, our code is going to have a main loop that will poll the button every time through. Kind of like kids in the back seat on a long car trip, our code will be constantly asking, "Is the button pressed now? Is the button pressed now? Is the button pressed now? Is the button pressed now?"
Polling is effective, but as we'll see in a later installment, it's not the most efficient use of the CPU and there are often better solutions. For now, though, it's quick and easy, so let's go! Continue reading The STM32F429I-DISCO Tutorial Series, Part 5: GPIO: Lighting an LED when the Button is Pressed Using Polling