Blinky test program for Black Pill board with STM32F411CEU6

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2019 ARM Limited
00003  * SPDX-License-Identifier: Apache-2.0
00004  */
00005 
00006 #include "mbed.h"
00007 #include "platform/mbed_thread.h"
00008 
00009 
00010 // Blinking rate in milliseconds
00011 #define BLINKING_RATEA_MS 200
00012 #define BLINKING_RATEB_MS 1000
00013 
00014 
00015 int main()
00016 {
00017     // Initialise the digital pin LED1 as an output
00018     DigitalOut led(PC_13);
00019 
00020     while (true) {
00021         led = !led;
00022         thread_sleep_for(BLINKING_RATEA_MS);
00023         led = !led;
00024         thread_sleep_for(BLINKING_RATEA_MS);
00025         led = !led;
00026         thread_sleep_for(BLINKING_RATEB_MS);
00027         led = !led;
00028         thread_sleep_for(BLINKING_RATEA_MS);
00029     }
00030 }