![](/media/cache/group/gazou_0224.jpg.50x50_q85.jpg)
RotaryEncoder program only rotation speed.
Dependencies: mbed
Revision 0:6bbb8b1d5ead, committed 2015-02-22
- Comitter:
- tknara
- Date:
- Sun Feb 22 08:57:46 2015 +0000
- Commit message:
- RotaryEncoder
Changed in this revision
encoder.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/encoder.cpp Sun Feb 22 08:57:46 2015 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +Serial pc(USBTX,USBRX); +InterruptIn encA(p6); +/* +DigitalIn encA(p6); +DigitalIn encB(p5); +*/ +int Rota,count,n = 1; +void counter(void){ + count++; + if(count == 360*n){ + Rota++; + n++; + pc.printf("%d\n",Rota); + } +} +int main() { + while(1){ + pc.printf("www"); + encA.rise(&counter); + } +} + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 22 08:57:46 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file