Motor component testing
Dependencies: Encoder HIDScope mbed
Revision 0:2240263f7068, committed 2014-10-23
- Comitter:
- phgbartels
- Date:
- Thu Oct 23 09:09:24 2014 +0000
- Commit message:
- Motor component testing
Changed in this revision
diff -r 000000000000 -r 2240263f7068 Encoder.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Encoder.lib Thu Oct 23 09:09:24 2014 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/vsluiter/code/Encoder/#18b000b443af
diff -r 000000000000 -r 2240263f7068 HIDScope.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HIDScope.lib Thu Oct 23 09:09:24 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tomlankhorst/code/HIDScope/#e44574634162
diff -r 000000000000 -r 2240263f7068 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 23 09:09:24 2014 +0000 @@ -0,0 +1,60 @@ +#include "mbed.h" +#include "encoder.h" +//#include "HIDScope.h" +#include "PwmOut.h" +#define M1_PWM PTA5 +#define M1_DIR PTA4 + +Encoder motor1(PTD3,PTD1, true); +PwmOut pwm_motor1(M1_PWM); +DigitalOut motordir1(M1_DIR); +DigitalOut LED(LED_GREEN); + +float PWM = 0.2; /// (1000/200); +//HIDScope scope(3); + +int main() { + //pwm_motor1.period_us(100); + //pwm_motor1.write(PWM); + LED = 0; + motordir1 = 1; + while(true) { + //wait(3); + pwm_motor1.write(0.4); + LED = 1; + //wait(1); + //PWM = PWM + 0.05; + + //pwm_motor1.pulsewidth_us(50); + + //scope.set(0, motor1.getPosition()); + //scope.set(1, DigitalIn(PTD3)); + //scope.set(2, DigitalIn(PTD1)); + //scope.send(); + //wait(0.01); + + /* + while (PWM > 0) { + PWM = PWM - 0.005; + motordir1 = 0; + pwm_motor1.write(PWM); + scope.set(0, motor1.getPosition()); + scope.set(1, DigitalIn(PTD3)); + scope.set(2, DigitalIn(PTD1)); + scope.set(3, pwm_motor1); + scope.send(); + wait(0.005); + } + while (PWM < 1) { + PWM = PWM + 0.005; + motordir1 = 0; + pwm_motor1.write(PWM); + scope.set(0, motor1.getPosition()); + scope.set(1, DigitalIn(PTD3)); + scope.set(2, DigitalIn(PTD1)); + scope.set(3, pwm_motor1); + scope.send(); + wait(0.005); + }*/ + } +}
diff -r 000000000000 -r 2240263f7068 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Oct 23 09:09:24 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file