Programa base para la tarjeta STM32-MINIMO, usando la libreria mbed-dev.
Fork of STM32F103C8T6_Hello by
main.cpp@10:4b88be251088, 2016-09-15 (annotated)
- Committer:
- hudakz
- Date:
- Thu Sep 15 18:40:03 2016 +0000
- Revision:
- 10:4b88be251088
- Parent:
- 9:d3fb631890d7
- Child:
- 11:7ad02c61c1f9
Updated.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 5:3c3ef17a17a6 | 1 | #include "stm32f103c8t6.h" |
hudakz | 0:ab218237069e | 2 | #include "mbed.h" |
hudakz | 10:4b88be251088 | 3 | |
hudakz | 0:ab218237069e | 4 | int main() { |
hudakz | 10:4b88be251088 | 5 | confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) |
hudakz | 10:4b88be251088 | 6 | |
hudakz | 10:4b88be251088 | 7 | Serial pc(PA_2, PA_3); |
hudakz | 10:4b88be251088 | 8 | DigitalOut myled(LED1); |
hudakz | 10:4b88be251088 | 9 | |
hudakz | 0:ab218237069e | 10 | while(1) { |
hudakz | 5:3c3ef17a17a6 | 11 | // The on-board LED is connected, via a resistor, to +3.3V (not to GND). |
hudakz | 3:c6a589f444b9 | 12 | // So to turn the LED on or off we have to set it to 0 or 1 respectively |
hudakz | 7:accb2c83a007 | 13 | myled = 0; // turn the LED on |
hudakz | 10:4b88be251088 | 14 | wait_ms(200); // 200 millisecond |
hudakz | 7:accb2c83a007 | 15 | myled = 1; // turn the LED off |
hudakz | 10:4b88be251088 | 16 | wait_ms(1000); // 1000 millisecond |
hudakz | 5:3c3ef17a17a6 | 17 | pc.printf("Blink\r\n"); |
hudakz | 0:ab218237069e | 18 | } |
hudakz | 0:ab218237069e | 19 | } |
hudakz | 8:f1432e9af6c8 | 20 |