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:1f3576ebcecb, 2015-05-17 (annotated)
- Committer:
- WAT34
- Date:
- Sun May 17 05:42:44 2015 +0000
- Revision:
- 0:1f3576ebcecb
ikarashiniyorosiku
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WAT34 | 0:1f3576ebcecb | 1 | #include "mbed.h" |
WAT34 | 0:1f3576ebcecb | 2 | #include "QEI.h" |
WAT34 | 0:1f3576ebcecb | 3 | QEI loli(p21,p22,NC,621); |
WAT34 | 0:1f3576ebcecb | 4 | Serial pc(USBTX,USBRX); |
WAT34 | 0:1f3576ebcecb | 5 | |
WAT34 | 0:1f3576ebcecb | 6 | int main() { |
WAT34 | 0:1f3576ebcecb | 7 | int pulse; |
WAT34 | 0:1f3576ebcecb | 8 | while(1){ |
WAT34 | 0:1f3576ebcecb | 9 | pulse = loli.getPulses()/2; |
WAT34 | 0:1f3576ebcecb | 10 | if (pulse >=360){ |
WAT34 | 0:1f3576ebcecb | 11 | pulse -= 360; |
WAT34 | 0:1f3576ebcecb | 12 | } |
WAT34 | 0:1f3576ebcecb | 13 | if (pulse <= -360){ |
WAT34 | 0:1f3576ebcecb | 14 | pulse += 360; |
WAT34 | 0:1f3576ebcecb | 15 | } |
WAT34 | 0:1f3576ebcecb | 16 | pc.printf("%d\n\r",pulse); |
WAT34 | 0:1f3576ebcecb | 17 | } |
WAT34 | 0:1f3576ebcecb | 18 | } |