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

Dependencies:   mbed-src

main.cpp

Committer:
Foxnec
Date:
2015-05-12
Revision:
3:71536f3ef899
Parent:
2:2290577c8ac4

File content as of revision 3:71536f3ef899:

/**********************************************************************************
* @file    main.cpp
* @author  Marta Krepelkova
* @version V0.1
* @date    26-April-2015
* @brief   LED blinking with microcontroller in a small package (TSSOP20), 4kB RAM
*          Modified mbed-library.
*          DO NOT FORGET TO SELECT NUCLEO-F030R8 AS YOUR MBED PLATFORM!
***********************************************************************************/
 
/**********************************************************************************/
/*   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 OFF (we have connected it to VCC)
        wait(0.2); // 200 ms
        myled = 0; // LED is ON
        wait(1.0); // 1 sec
    }
}