Microcontroller Tutorials

Arduino, Raspberry Pi, PIC, Beaglebone Resources

Blink a LED with STM32 Nucleo

by Roland Pelayo

On the previous tutorial, we managed to create our first program with the STM32 Nucleo board. Now we will dig deeper on the pinout and other functionalities of the board.

The ST Nucleo F103RB page on the Mbed website contains information about the Arduino header pins of the board. Here is the top-left side:

/media/uploads/adustm/nucleo_f103rb_arduino_left_2016_7_21_1.png

You’ll see that the pin assignments is very much like the Arduino UNO. In fact, you can use the same pin names (A0, A1, etc.) when programming in Mbed.

Here’s the top-right side:

/media/uploads/adustm/nucleo_f103rb_arduino_right_2016_7_21_1.png

Again, the similarities with the Arduino UNO is still there, making the Nucleo board compatible with Arduino shields.

Besides the Arduino headers, there are also Morpho headers which gives the user access to all of the pins of the STM32F10RB:

/media/uploads/adustm/nucleo_f103rb_morpho_left_2016_7_21_1.png

/media/uploads/adustm/nucleo_f103rb_morpho_right_2016_7_21_1.png

This gives us an additional 76 pins to work with, much more than the Arduino Mega!

With knowledge on the pin names, I am ready to create some more programs. I attached an LED to D5 using the Grove shield:

STM32 Nucleo with LED attached

Then I created a program that blinks the LED faster and faster:

The LED still blinks if I change the pin name from D5 to PB_4 (which is standard STM32 naming):

Here’s the video showing the LED blinking:

On the next part of this tutorial, I will show you how to include a button to control the blinking of the LED.

 

Next >> Input and Output