Blink 0.2
Dependencies: mbed-STM32F030F4
Fork of STM32F031_blink_LED_2 by
main.cpp@0:ccaa0ada3fe9, 2015-04-26 (annotated)
- Committer:
- krepemar
- Date:
- Sun Apr 26 19:46:19 2015 +0000
- Revision:
- 0:ccaa0ada3fe9
- Child:
- 1:6d1a367bdba2
LED blinking with small microcontroller
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 | 0:ccaa0ada3fe9 | 39 | myled = 1; // LED is ON |
krepemar | 0:ccaa0ada3fe9 | 40 | wait(0.2); // 200 ms |
krepemar | 0:ccaa0ada3fe9 | 41 | myled = 0; // LED is OFF |
krepemar | 0:ccaa0ada3fe9 | 42 | wait(1.0); // 1 sec |
krepemar | 0:ccaa0ada3fe9 | 43 | } |
krepemar | 0:ccaa0ada3fe9 | 44 | } |