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