Joseph Bradshaw
/
mbed_ES410_simpleSpeedMeasurement
ES410 Simple Speed Measurement
Revision 0:f8cf3c133d6a, committed 2016-05-23
- Comitter:
- jebradshaw
- Date:
- Mon May 23 19:01:51 2016 +0000
- Commit message:
- ES410 simple speed measurement program
Changed in this revision
--- /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