Encoder test(rotation sensor) for CORE-1000

Dependencies:   mbed

Revision:
1:38643472f93f
Parent:
0:75e3cf27c60b
--- 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 );
     }
 }