Thanks to Zoltan Hudak publish the way to use STM32F103c8t6 on mbed. Now, this example can let you use it with a encoder.
Dependencies: QEI mbed-STM32F103C8T6 mbed
Fork of STM32F103C8T6_Hello by
main.cpp@6:d99931fc19c0, 2016-07-05 (annotated)
- Committer:
- hudakz
- Date:
- Tue Jul 05 18:24:49 2016 +0000
- Revision:
- 6:d99931fc19c0
- Parent:
- 5:3c3ef17a17a6
- Child:
- 7:accb2c83a007
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 | 0:ab218237069e | 3 | |
hudakz | 6:d99931fc19c0 | 4 | Serial pc(PA_2, PA_3); |
hudakz | 5:3c3ef17a17a6 | 5 | DigitalOut myled(LED1); |
hudakz | 0:ab218237069e | 6 | |
hudakz | 0:ab218237069e | 7 | int main() { |
hudakz | 6:d99931fc19c0 | 8 | configSysClock(); // selecting 72MHz High-speed External clock |
hudakz | 0:ab218237069e | 9 | while(1) { |
hudakz | 5:3c3ef17a17a6 | 10 | // The on-board LED is connected, via a resistor, to +3.3V (not to GND). |
hudakz | 3:c6a589f444b9 | 11 | // So to turn the LED on or off we have to set it to 0 or 1 respectively |
hudakz | 3:c6a589f444b9 | 12 | myled = 0; // turn the LED on |
hudakz | 0:ab218237069e | 13 | wait(0.2); // 200 ms |
hudakz | 3:c6a589f444b9 | 14 | myled = 1; // turn the LED off |
hudakz | 0:ab218237069e | 15 | wait(1.0); // 1 sec |
hudakz | 5:3c3ef17a17a6 | 16 | pc.printf("Blink\r\n"); |
hudakz | 0:ab218237069e | 17 | } |
hudakz | 0:ab218237069e | 18 | } |