RotaryEncoder program only rotation speed.
Dependencies: mbed
encoder.cpp
- Committer:
- tknara
- Date:
- 2015-02-22
- Revision:
- 0:6bbb8b1d5ead
File content as of revision 0:6bbb8b1d5ead:
#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); } }