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