Encoder test(rotation sensor) for CORE-1000
Dependencies: mbed
Revision 1:38643472f93f, committed 2017-02-03
- Comitter:
- odb
- Date:
- Fri Feb 03 08:02:34 2017 +0000
- Parent:
- 0:75e3cf27c60b
- Commit message:
- CORE-1000 First
Changed in this revision
main.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 |
diff -r 75e3cf27c60b -r 38643472f93f main.cpp --- a/main.cpp Mon Dec 31 15:22:03 2012 +0000 +++ b/main.cpp Fri Feb 03 08:02:34 2017 +0000 @@ -1,7 +1,8 @@ #include "mbed.h" -DigitalIn phaseA( p5 ); // phase a of the quadrature encoder -DigitalIn phaseB( p6 ); // phase b of the quadrature encoder +DigitalIn phaseA( PA_0 ); // phase a of the quadrature encoder +DigitalIn phaseB( PA_1 ); // phase b of the quadrature encoder +DigitalIn click( PA_4 ); int encoderClickCount = 0; // hold the signed value corresponding to the number of clicks left or right since last sample int previousEncoderState = 0; // keep a record of the last actioned sample state of the Qb+Qa outputs for comparison on each interrupt @@ -95,6 +96,9 @@ { pc.printf( "click count = %d,%d\r\n", currentClicks, previousEncoderState ); } + if(!click) + { printf (" clicked \r\n"); + } wait_ms( 200 ); } }
diff -r 75e3cf27c60b -r 38643472f93f mbed.bld --- a/mbed.bld Mon Dec 31 15:22:03 2012 +0000 +++ b/mbed.bld Fri Feb 03 08:02:34 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/63cdd78b2dc1 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f \ No newline at end of file