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

Dependencies:   mbed-src

Revision:
0:ff314d068cee
Child:
2:2290577c8ac4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 26 19:49:10 2015 +0000
@@ -0,0 +1,44 @@
+/**********************************************************************************
+* @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
+    }
+}