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.
Dependencies: mbed QEI-1 nRF24L01P xiugai
main.cpp@0:e63858fec119, 2018-04-30 (annotated)
- Committer:
- glintligo
- Date:
- Mon Apr 30 13:48:51 2018 +0000
- Revision:
- 0:e63858fec119
- Child:
- 1:1e3eb2d1496b
fasdfs;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| glintligo | 0:e63858fec119 | 1 | #include "mbed.h" |
| glintligo | 0:e63858fec119 | 2 | #include "QEI.h" |
| glintligo | 0:e63858fec119 | 3 | Serial pc(PA_2, PA_3); |
| glintligo | 0:e63858fec119 | 4 | PwmOut mypwm1(PB_7); |
| glintligo | 0:e63858fec119 | 5 | PwmOut mypwm2(PB_6); |
| glintligo | 0:e63858fec119 | 6 | QEI wheel(PB_10, PB_11, NC, 11, QEI::X4_ENCODING); |
| glintligo | 0:e63858fec119 | 7 | int x; |
| glintligo | 0:e63858fec119 | 8 | int main() { |
| glintligo | 0:e63858fec119 | 9 | |
| glintligo | 0:e63858fec119 | 10 | mypwm1.period_ms(2); |
| glintligo | 0:e63858fec119 | 11 | mypwm2.period_ms(2); |
| glintligo | 0:e63858fec119 | 12 | mypwm1.pulsewidth(0.001); |
| glintligo | 0:e63858fec119 | 13 | mypwm2.pulsewidth(0.001); |
| glintligo | 0:e63858fec119 | 14 | while(1) |
| glintligo | 0:e63858fec119 | 15 | { |
| glintligo | 0:e63858fec119 | 16 | wait(0.1); |
| glintligo | 0:e63858fec119 | 17 | x = wheel.getPulses(); |
| glintligo | 0:e63858fec119 | 18 | pc.printf("Pulses is: %i\n", x); |
| glintligo | 0:e63858fec119 | 19 | } |
| glintligo | 0:e63858fec119 | 20 | } |