Blink 0.2
Dependencies: mbed-STM32F030F4
Fork of STM32F031_blink_LED_2 by
main.cpp@2:ea82db1b8367, 2015-05-12 (annotated)
- Committer:
- Foxnec
- Date:
- Tue May 12 09:58:12 2015 +0000
- Revision:
- 2:ea82db1b8367
- Parent:
- 1:6d1a367bdba2
- Child:
- 3:28b148d0e703
Changes to 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 |
Foxnec | 2:ea82db1b8367 | 6 | * @brief LED blinking with microcontroller in a small package (TSSOP20), 4kB RAM |
Foxnec | 2:ea82db1b8367 | 7 | * Modified mbed-library. |
krepemar | 0:ccaa0ada3fe9 | 8 | ***********************************************************************************/ |
krepemar | 0:ccaa0ada3fe9 | 9 | |
krepemar | 0:ccaa0ada3fe9 | 10 | /**********************************************************************************/ |
krepemar | 0:ccaa0ada3fe9 | 11 | /* Table of used pins on STM32F0 Discovery kit with STM32F031F6P6 MCU (TSSOP20) */ |
krepemar | 0:ccaa0ada3fe9 | 12 | /**********************************************************************************/ |
krepemar | 0:ccaa0ada3fe9 | 13 | /* TSSOP20 pin | peripheral */ |
krepemar | 0:ccaa0ada3fe9 | 14 | /* 11 (PA_5) | LED */ |
krepemar | 0:ccaa0ada3fe9 | 15 | /**********************************************************************************/ |
krepemar | 0:ccaa0ada3fe9 | 16 | |
krepemar | 0:ccaa0ada3fe9 | 17 | /* Includes ----------------------------------------------------------------------*/ |
krepemar | 0:ccaa0ada3fe9 | 18 | #include "mbed.h" |
krepemar | 0:ccaa0ada3fe9 | 19 | |
krepemar | 0:ccaa0ada3fe9 | 20 | /* Defines -----------------------------------------------------------------------*/ |
krepemar | 0:ccaa0ada3fe9 | 21 | |
krepemar | 0:ccaa0ada3fe9 | 22 | /* Function prototypes -----------------------------------------------------------*/ |
krepemar | 0:ccaa0ada3fe9 | 23 | |
krepemar | 0:ccaa0ada3fe9 | 24 | /* Variables ---------------------------------------------------------------------*/ |
krepemar | 0:ccaa0ada3fe9 | 25 | |
krepemar | 0:ccaa0ada3fe9 | 26 | // mbed - initialization of peripherals |
krepemar | 0:ccaa0ada3fe9 | 27 | DigitalOut myled(PA_5); // LED is connected to PA_5 |
krepemar | 0:ccaa0ada3fe9 | 28 | |
krepemar | 0:ccaa0ada3fe9 | 29 | /* Functions----------------------------------------------------------------------*/ |
krepemar | 0:ccaa0ada3fe9 | 30 | |
krepemar | 0:ccaa0ada3fe9 | 31 | /*********************************************************************************** |
krepemar | 0:ccaa0ada3fe9 | 32 | * Function Name : main. |
krepemar | 0:ccaa0ada3fe9 | 33 | * Description : Main routine. |
krepemar | 0:ccaa0ada3fe9 | 34 | * Input : None. |
krepemar | 0:ccaa0ada3fe9 | 35 | * Output : None. |
krepemar | 0:ccaa0ada3fe9 | 36 | * Return : None. |
krepemar | 0:ccaa0ada3fe9 | 37 | ***********************************************************************************/ |
krepemar | 0:ccaa0ada3fe9 | 38 | int main() { |
krepemar | 0:ccaa0ada3fe9 | 39 | while(1) { |
krepemar | 1:6d1a367bdba2 | 40 | myled = 1; // LED is OFF (we have connected it to VCC) |
krepemar | 0:ccaa0ada3fe9 | 41 | wait(0.2); // 200 ms |
krepemar | 1:6d1a367bdba2 | 42 | myled = 0; // LED is On |
krepemar | 0:ccaa0ada3fe9 | 43 | wait(1.0); // 1 sec |
krepemar | 0:ccaa0ada3fe9 | 44 | } |
krepemar | 0:ccaa0ada3fe9 | 45 | } |