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@7:accb2c83a007, 2016-07-05 (annotated)
- Committer:
- hudakz
- Date:
- Tue Jul 05 18:57:42 2016 +0000
- Revision:
- 7:accb2c83a007
- Parent:
- 6:d99931fc19c0
- Child:
- 8:f1432e9af6c8
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 | 7:accb2c83a007 | 8 | confSysClock(); // Configuring system 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 | 7:accb2c83a007 | 12 | myled = 0; // turn the LED on |
hudakz | 7:accb2c83a007 | 13 | wait(0.2); // 200 ms |
hudakz | 7:accb2c83a007 | 14 | myled = 1; // turn the LED off |
hudakz | 7:accb2c83a007 | 15 | wait(1.0); // 1 sec |
hudakz | 5:3c3ef17a17a6 | 16 | pc.printf("Blink\r\n"); |
hudakz | 0:ab218237069e | 17 | } |
hudakz | 0:ab218237069e | 18 | } |