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@9:d3fb631890d7, 2016-08-13 (annotated)
- Committer:
- hudakz
- Date:
- Sat Aug 13 11:56:02 2016 +0000
- Revision:
- 9:d3fb631890d7
- Parent:
- 8:f1432e9af6c8
- Child:
- 10:4b88be251088
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 | 8:f1432e9af6c8 | 3 | |
hudakz | 6:d99931fc19c0 | 4 | Serial pc(PA_2, PA_3); |
hudakz | 5:3c3ef17a17a6 | 5 | DigitalOut myled(LED1); |
hudakz | 8:f1432e9af6c8 | 6 | |
hudakz | 0:ab218237069e | 7 | int main() { |
hudakz | 0:ab218237069e | 8 | while(1) { |
hudakz | 5:3c3ef17a17a6 | 9 | // The on-board LED is connected, via a resistor, to +3.3V (not to GND). |
hudakz | 3:c6a589f444b9 | 10 | // So to turn the LED on or off we have to set it to 0 or 1 respectively |
hudakz | 7:accb2c83a007 | 11 | myled = 0; // turn the LED on |
hudakz | 7:accb2c83a007 | 12 | wait(0.2); // 200 ms |
hudakz | 7:accb2c83a007 | 13 | myled = 1; // turn the LED off |
hudakz | 7:accb2c83a007 | 14 | wait(1.0); // 1 sec |
hudakz | 5:3c3ef17a17a6 | 15 | pc.printf("Blink\r\n"); |
hudakz | 0:ab218237069e | 16 | } |
hudakz | 0:ab218237069e | 17 | } |
hudakz | 8:f1432e9af6c8 | 18 |