LED blinking with a small microcontroller (STM32F031/F050) with 4kB of RAM.

Dependencies:   mbed-src

main.cpp

Committer:
krepemar
Date:
2015-04-26
Revision:
0:ff314d068cee
Child:
2:2290577c8ac4

File content as of revision 0:ff314d068cee:

/**********************************************************************************
* @file    main.cpp
* @author  Marta Krepelkova
* @version V0.1
* @date    26-April-2015
* @brief   LED blinking with microcontroller in a small package
***********************************************************************************/
 
/**********************************************************************************/
/*   Table of used pins on STM32F0 Discovery kit with STM32F031F6P6 MCU (TSSOP20) */
/**********************************************************************************/
/*  TSSOP20 pin     |     peripheral                                              */
/*   11 (PA_5)      |     LED                                                     */
/**********************************************************************************/
 
/* Includes ----------------------------------------------------------------------*/
#include "mbed.h"

/* Defines -----------------------------------------------------------------------*/
 
/* Function prototypes -----------------------------------------------------------*/
 
/* Variables ---------------------------------------------------------------------*/

// mbed - initialization of peripherals
DigitalOut myled(PA_5); // LED is connected to PA_5

/* Functions----------------------------------------------------------------------*/

/***********************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
***********************************************************************************/
int main() {
    while(1) {
        myled = 1; // LED is ON
        wait(0.2); // 200 ms
        myled = 0; // LED is OFF
        wait(1.0); // 1 sec
    }
}