ES410 Simple Speed Measurement

Dependencies:   MotCon QEI mbed

Files at this revision

API Documentation at this revision

Comitter:
jebradshaw
Date:
Mon May 23 19:01:51 2016 +0000
Commit message:
ES410 simple speed measurement program

Changed in this revision

MotCon.lib Show annotated file Show diff for this revision Revisions of this file
QEI.lib 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
mbed_ES410_simpleSpeedMeasurement.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MotCon.lib	Mon May 23 19:01:51 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/jebradshaw/code/MotCon/#382121501487
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QEI.lib	Mon May 23 19:01:51 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/aberk/code/QEI/#5c2ad81551aa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 23 19:01:51 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7c328cabac7e
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_ES410_simpleSpeedMeasurement.cpp	Mon May 23 19:01:51 2016 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+#include "MotCon.h"
+#include "QEI.h"
+
+QEI enc1(p24,p23,NC,800, QEI::X4_ENCODING); //Global Motor 800 cpr w x4 encoding
+MotCon motor(p26, p28);       //pwm output, direction
+
+int main() {
+    long e[210];     // vector to save encoder readings
+    int k;    
+    
+    motor.mot_control(0.5);   // sets motor voltage duty cucle, example  25% (12*0.25=3 V)
+    
+    for(k=1;k<=100;k++){ // take x=100 readings
+        e[k]=enc1.getPulses();    // read the encoder
+        wait(.050);   // wait x=50 ms between the readings         
+    }
+    motor.mot_control(0.0);
+    for(k=1;k<=100;k++){   // print readings to screen so you can import to MATLAB
+        printf("%d\r\n",e[k]);
+    }    
+}//main
\ No newline at end of file