dev01 Brautlecht / STM32F031_Blink_Aug17

Dependencies:   mbed-STM32F030F4

Fork of STM32F031_blink_LED_2 by Cortex Challenge Team

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /**********************************************************************************
00002 * @file    main.cpp
00003 * @author  Marta Krepelkova
00004 * @version V0.1
00005 * @date    26-April-2015
00006 * @brief   LED blinking with microcontroller in a small package (TSSOP20), 4kB RAM
00007 *          Modified mbed-library.
00008 *          DO NOT FORGET TO SELECT NUCLEO-F030R8 AS YOUR MBED PLATFORM!
00009 ***********************************************************************************/
00010  
00011 /**********************************************************************************/
00012 /*   Table of used pins on STM32F0 Discovery kit with STM32F031F6P6 MCU (TSSOP20) */
00013 /**********************************************************************************/
00014 /*  TSSOP20 pin     |     peripheral                                              */
00015 /*   11 (PA_5)      |     LED                                                     */
00016 /**********************************************************************************/
00017  
00018 /* Includes ----------------------------------------------------------------------*/
00019 #include "mbed.h"
00020 
00021 /* Defines -----------------------------------------------------------------------*/
00022  
00023 /* Function prototypes -----------------------------------------------------------*/
00024  
00025 /* Variables ---------------------------------------------------------------------*/
00026 
00027 // mbed - initialization of peripherals
00028 DigitalOut myled_ext(PA_5); // LED is connected to PA_5
00029 DigitalOut myled_onb(PA_4); // LED is connected to PA_4 onboard
00030 /* Functions----------------------------------------------------------------------*/
00031 
00032 /***********************************************************************************
00033 * Function Name  : main.
00034 * Description    : Main routine.
00035 * Input          : None.
00036 * Output         : None.
00037 * Return         : None.
00038 ***********************************************************************************/
00039 int main() {
00040     while(1) {
00041         myled_ext = 1; // LED is OFF (we have connected it to VCC)
00042 
00043         myled_onb = 0;
00044         wait(0.1); // 200 ms
00045         myled_onb = 1;
00046         wait(0.1); // 200 ms
00047         myled_onb = 0;
00048         wait(0.1); // 200 ms
00049         myled_onb = 1;
00050         wait(0.1); // 200 ms
00051         myled_onb = 0;
00052         wait(1.0); // 200 ms
00053 
00054         myled_ext = 0; // LED is On
00055         myled_onb = 1;
00056         wait(2.0); // 1 sec
00057     }
00058 }