Introduction: STM32F103 Digital Input (using Med.h)

In this tutorial, we will learn about reading digital input from GPIO Pins in STM32F103 Nucloe Board using mebd.h.

Step 1: Coding and Compiling

Creating Project

Now, open the compiler on mbed developer website. Click on "NEW" to create a new project. Set Platform to 'NUCLEO-F103RB'. From the template select 'Read the board user button state'. Enter a program name. Click 'ok'. Open 'main.cpp' if not already open.

And here is the code you will need to read that blue push button on your nucleo board and control that LED on you nucleo using this button. This code is very similar to one explained in "Getting started (using mbed) tutorial".


Compile this code by clicking on compile button. Download this onto your Nucleo Board. Or if downloaded somewhere else drag from there and drop onto Nucleo Directory in your 'This PC'/'My Computer'. This will flash this code onto your STM32 Nucleo Board.

Now, Push that blue button on your board and see what happen to LED! :)