Signa-bot code for project BioRobotics, at University of Twente.
Dependencies: mbed QEI MODSERIAL FastPWM ttmath Math
Diff: Motor_tryout.cpp
- Revision:
- 9:61bdf58f856e
- Parent:
- 8:017b813c72bb
- Child:
- 11:7c2d492466c2
- Child:
- 12:2382468d36a4
diff -r 017b813c72bb -r 61bdf58f856e Motor_tryout.cpp --- a/Motor_tryout.cpp Thu Oct 03 14:26:41 2019 +0000 +++ b/Motor_tryout.cpp Thu Oct 03 14:43:45 2019 +0000 @@ -1,7 +1,7 @@ #include "mbed.h" #include "MODSERIAL.h" -// test +// test, hallo DigitalOut motor1_pwm(PTC2); // aansturen motor 1, via poort PTC2 DigitalIn motor1_1(PTD1); // data vanuit motor 1 @@ -35,15 +35,19 @@ pc.printf("Motor 1\r\n"); motor1_pwm.write(pct/100.0); // write Duty Cycle wait(1.0f); - for(int tijd = 0 ; pct <= 100 ; pct += 1) - { - int tijd2 = tijd + pct/10*100; - int Outm1 = motor1_1.read(); - DataM[tijd2] = Outm1; - wait(0.01f); - } + //for(int tijd = 0 ; pct <= 100 ; pct += 1) + // { + // int tijd2 = tijd + pct/10*10; + // int Outm1 = motor1_1.read(); + // DataM[tijd2] = Outm1; + // wait(0.1f); + // } + } + for (int pr = 0 ; pr <= 100; pr += 1); + { + int value = DataM[pr]; + pc.printf("Data motor 1 is %i", value); } - pc.printf("Data motor 1 is %i", DataM); motor1_pwm.write(0.0f); // motor 1 off again pc.printf("Motor 1 off\r\n"); for(int pct = 0 ; pct <= 100 ; pct += 10)