Encoder test(rotation sensor) for CORE-1000

Dependencies:   mbed

Files at this revision

API Documentation at this revision

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
--- 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 );
     }
 }
--- 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