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

Dependencies:   mbed-src

Committer:
Foxnec
Date:
Tue May 12 10:09:19 2015 +0000
Revision:
3:71536f3ef899
Parent:
2:2290577c8ac4
Changes to comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
krepemar 0:ff314d068cee 1 /**********************************************************************************
krepemar 0:ff314d068cee 2 * @file main.cpp
krepemar 0:ff314d068cee 3 * @author Marta Krepelkova
krepemar 0:ff314d068cee 4 * @version V0.1
krepemar 0:ff314d068cee 5 * @date 26-April-2015
Foxnec 3:71536f3ef899 6 * @brief LED blinking with microcontroller in a small package (TSSOP20), 4kB RAM
Foxnec 3:71536f3ef899 7 * Modified mbed-library.
Foxnec 3:71536f3ef899 8 * DO NOT FORGET TO SELECT NUCLEO-F030R8 AS YOUR MBED PLATFORM!
krepemar 0:ff314d068cee 9 ***********************************************************************************/
krepemar 0:ff314d068cee 10
krepemar 0:ff314d068cee 11 /**********************************************************************************/
krepemar 0:ff314d068cee 12 /* Table of used pins on STM32F0 Discovery kit with STM32F031F6P6 MCU (TSSOP20) */
krepemar 0:ff314d068cee 13 /**********************************************************************************/
krepemar 0:ff314d068cee 14 /* TSSOP20 pin | peripheral */
krepemar 0:ff314d068cee 15 /* 11 (PA_5) | LED */
krepemar 0:ff314d068cee 16 /**********************************************************************************/
krepemar 0:ff314d068cee 17
krepemar 0:ff314d068cee 18 /* Includes ----------------------------------------------------------------------*/
krepemar 0:ff314d068cee 19 #include "mbed.h"
krepemar 0:ff314d068cee 20
krepemar 0:ff314d068cee 21 /* Defines -----------------------------------------------------------------------*/
krepemar 0:ff314d068cee 22
krepemar 0:ff314d068cee 23 /* Function prototypes -----------------------------------------------------------*/
krepemar 0:ff314d068cee 24
krepemar 0:ff314d068cee 25 /* Variables ---------------------------------------------------------------------*/
krepemar 0:ff314d068cee 26
krepemar 0:ff314d068cee 27 // mbed - initialization of peripherals
krepemar 0:ff314d068cee 28 DigitalOut myled(PA_5); // LED is connected to PA_5
krepemar 0:ff314d068cee 29
krepemar 0:ff314d068cee 30 /* Functions----------------------------------------------------------------------*/
krepemar 0:ff314d068cee 31
krepemar 0:ff314d068cee 32 /***********************************************************************************
krepemar 0:ff314d068cee 33 * Function Name : main.
krepemar 0:ff314d068cee 34 * Description : Main routine.
krepemar 0:ff314d068cee 35 * Input : None.
krepemar 0:ff314d068cee 36 * Output : None.
krepemar 0:ff314d068cee 37 * Return : None.
krepemar 0:ff314d068cee 38 ***********************************************************************************/
krepemar 0:ff314d068cee 39 int main() {
krepemar 0:ff314d068cee 40 while(1) {
krepemar 2:2290577c8ac4 41 myled = 1; // LED is OFF (we have connected it to VCC)
krepemar 0:ff314d068cee 42 wait(0.2); // 200 ms
krepemar 2:2290577c8ac4 43 myled = 0; // LED is ON
krepemar 0:ff314d068cee 44 wait(1.0); // 1 sec
krepemar 0:ff314d068cee 45 }
krepemar 0:ff314d068cee 46 }