Skip to main content

Subsection 1.2.2 Part 2: Get Blinky Running

Activity 1.2.1. Run Blinky.

Blinky is the “hello, world” of embedded programming, and we’ll get it running on your own board before we look at any of the code.

(a)

Prior to today’s class you were instructed to install STM32CubeIDE, the software we use to program the STM32C031C6, and to copy the course Library folder from Thayer Shares. You must have both done before you can go any farther. The instructions are in Section D.1.

(c)

Follow the instructions in Section D.3 to copy your TemplateProject to a new project named Blinky, add blinky.c (downloaded from the link in that section) to its Src folder, build it, and flash it to your Nucleo board. The green on-board LED should start blinking. Once it does, we’ll talk about how the program works.

Activity 1.2.2. Change the Delay Loop.

(a)

In the Project Explorer panel on the left, expand your project folder, then expand the Src subfolder. Double-click blinky.c to open it in the editor.
Find the delay loop: for (int i = 0; i < 100000; i++);. Change 100000 to 1000000 (one extra zero). Then click the hammer icon (Build) and, once the build succeeds, the play icon (Run) to flash the board. What changes?

(b)

Change the loop bound to 10000 and repeat. How fast can you make the LED blink before it appears to stop flickering?