Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:5d1c1999d61d, 2018-05-07 (annotated)
- Committer:
- himarsmty
- Date:
- Mon May 07 06:58:54 2018 +0000
- Revision:
- 0:5d1c1999d61d
s
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
himarsmty | 0:5d1c1999d61d | 1 | #include "Omni.h" |
himarsmty | 0:5d1c1999d61d | 2 | #include "QEI.h" |
himarsmty | 0:5d1c1999d61d | 3 | Serial pc(PB_10,PB_11); |
himarsmty | 0:5d1c1999d61d | 4 | |
himarsmty | 0:5d1c1999d61d | 5 | QEI wheel1(PA_2, PA_3, NC, 11, QEI::X4_ENCODING); |
himarsmty | 0:5d1c1999d61d | 6 | QEI wheel2(PA_9, PA_10, NC, 11, QEI::X4_ENCODING); |
himarsmty | 0:5d1c1999d61d | 7 | QEI wheel3(PA_0, PA_1, NC, 11, QEI::X4_ENCODING); |
himarsmty | 0:5d1c1999d61d | 8 | Ticker toggle_time_ticker; |
himarsmty | 0:5d1c1999d61d | 9 | int get_v1,get_v2,get_v3; |
himarsmty | 0:5d1c1999d61d | 10 | void time_ticker(); |
himarsmty | 0:5d1c1999d61d | 11 | int main() |
himarsmty | 0:5d1c1999d61d | 12 | { |
himarsmty | 0:5d1c1999d61d | 13 | Omni my_omni; |
himarsmty | 0:5d1c1999d61d | 14 | my_omni.mv_x(600); |
himarsmty | 0:5d1c1999d61d | 15 | wheel1.reset(); |
himarsmty | 0:5d1c1999d61d | 16 | wheel2.reset(); |
himarsmty | 0:5d1c1999d61d | 17 | wheel3.reset(); |
himarsmty | 0:5d1c1999d61d | 18 | // w1 = 0; |
himarsmty | 0:5d1c1999d61d | 19 | // w2 = 1; |
himarsmty | 0:5d1c1999d61d | 20 | toggle_time_ticker.attach(&time_ticker, 0.2); |
himarsmty | 0:5d1c1999d61d | 21 | |
himarsmty | 0:5d1c1999d61d | 22 | |
himarsmty | 0:5d1c1999d61d | 23 | } |
himarsmty | 0:5d1c1999d61d | 24 | void time_ticker(){ |
himarsmty | 0:5d1c1999d61d | 25 | get_v1 = wheel1.getPulses(); |
himarsmty | 0:5d1c1999d61d | 26 | get_v2=wheel2.getPulses(); |
himarsmty | 0:5d1c1999d61d | 27 | get_v3=wheel3.getPulses(); |
himarsmty | 0:5d1c1999d61d | 28 | wheel1.reset(); |
himarsmty | 0:5d1c1999d61d | 29 | wheel2.reset(); |
himarsmty | 0:5d1c1999d61d | 30 | wheel3.reset(); |
himarsmty | 0:5d1c1999d61d | 31 | pc.printf("%d %d %d\n ",get_v1,get_v2,get_v3); |
himarsmty | 0:5d1c1999d61d | 32 | } |