LED blinking with a small microcontroller (STM32F031/F050) with 4kB of RAM.
Dependencies: mbed-src
main.cpp@2:2290577c8ac4, 2015-04-26 (annotated)
- Committer:
- krepemar
- Date:
- Sun Apr 26 20:04:26 2015 +0000
- Revision:
- 2:2290577c8ac4
- Parent:
- 0:ff314d068cee
- Child:
- 3:71536f3ef899
new comments
Who changed what in which revision?
User | Revision | Line number | New 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 |
krepemar | 0:ff314d068cee | 6 | * @brief LED blinking with microcontroller in a small package |
krepemar | 0:ff314d068cee | 7 | ***********************************************************************************/ |
krepemar | 0:ff314d068cee | 8 | |
krepemar | 0:ff314d068cee | 9 | /**********************************************************************************/ |
krepemar | 0:ff314d068cee | 10 | /* Table of used pins on STM32F0 Discovery kit with STM32F031F6P6 MCU (TSSOP20) */ |
krepemar | 0:ff314d068cee | 11 | /**********************************************************************************/ |
krepemar | 0:ff314d068cee | 12 | /* TSSOP20 pin | peripheral */ |
krepemar | 0:ff314d068cee | 13 | /* 11 (PA_5) | LED */ |
krepemar | 0:ff314d068cee | 14 | /**********************************************************************************/ |
krepemar | 0:ff314d068cee | 15 | |
krepemar | 0:ff314d068cee | 16 | /* Includes ----------------------------------------------------------------------*/ |
krepemar | 0:ff314d068cee | 17 | #include "mbed.h" |
krepemar | 0:ff314d068cee | 18 | |
krepemar | 0:ff314d068cee | 19 | /* Defines -----------------------------------------------------------------------*/ |
krepemar | 0:ff314d068cee | 20 | |
krepemar | 0:ff314d068cee | 21 | /* Function prototypes -----------------------------------------------------------*/ |
krepemar | 0:ff314d068cee | 22 | |
krepemar | 0:ff314d068cee | 23 | /* Variables ---------------------------------------------------------------------*/ |
krepemar | 0:ff314d068cee | 24 | |
krepemar | 0:ff314d068cee | 25 | // mbed - initialization of peripherals |
krepemar | 0:ff314d068cee | 26 | DigitalOut myled(PA_5); // LED is connected to PA_5 |
krepemar | 0:ff314d068cee | 27 | |
krepemar | 0:ff314d068cee | 28 | /* Functions----------------------------------------------------------------------*/ |
krepemar | 0:ff314d068cee | 29 | |
krepemar | 0:ff314d068cee | 30 | /*********************************************************************************** |
krepemar | 0:ff314d068cee | 31 | * Function Name : main. |
krepemar | 0:ff314d068cee | 32 | * Description : Main routine. |
krepemar | 0:ff314d068cee | 33 | * Input : None. |
krepemar | 0:ff314d068cee | 34 | * Output : None. |
krepemar | 0:ff314d068cee | 35 | * Return : None. |
krepemar | 0:ff314d068cee | 36 | ***********************************************************************************/ |
krepemar | 0:ff314d068cee | 37 | int main() { |
krepemar | 0:ff314d068cee | 38 | while(1) { |
krepemar | 2:2290577c8ac4 | 39 | myled = 1; // LED is OFF (we have connected it to VCC) |
krepemar | 0:ff314d068cee | 40 | wait(0.2); // 200 ms |
krepemar | 2:2290577c8ac4 | 41 | myled = 0; // LED is ON |
krepemar | 0:ff314d068cee | 42 | wait(1.0); // 1 sec |
krepemar | 0:ff314d068cee | 43 | } |
krepemar | 0:ff314d068cee | 44 | } |