mencari respon motor launcher dengan fungsi step
Dependencies: Motor mbed millis
Fork of transfer_function_motor by
Revision 2:8f1bb7191680, committed 2017-04-13
- Comitter:
- Najib_irvani
- Date:
- Thu Apr 13 13:52:41 2017 +0000
- Parent:
- 1:3a234ff1442b
- Commit message:
- transfer motor;
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 |
diff -r 3a234ff1442b -r 8f1bb7191680 main.cpp --- a/main.cpp Thu Feb 16 16:25:31 2017 +0000 +++ b/main.cpp Thu Apr 13 13:52:41 2017 +0000 @@ -3,41 +3,37 @@ #include "Motor.h" #include "millis.h" -encoderKRAI encoder( PB_13, PB_14, 14, encoderKRAI::X4_ENCODING); +//encoderKRAI encoder( PC_12, PD_2, 28, encoderKRAI::X4_ENCODING); +encoderKRAI encoder( PC_10, PC_11, 28, encoderKRAI::X4_ENCODING); Serial pc(USBTX,USBRX); -Motor motor(PA_8,PC_1,PC_2); +//Motor motor(PB_3, PC_4, PA_10); +Motor motor(PA_5,PB_12,PA_11); unsigned long int previousMillis = 0; unsigned long int currentMillis; -double rpm; - +int rpm; + int main() { -startMillis(); +startMillis(); +pc.baud(115200); motor.speed(0.5); +startMillis(); while(1) { currentMillis = millis(); - if (currentMillis-previousMillis>=10) + if (currentMillis-previousMillis>=12.5) { - rpm = (double)encoder.getPulses(); - - - - + rpm = encoder.getPulses(); + pc.printf("%d\n",rpm); encoder.reset(); - pc.printf("%.04lf\n",rpm); - previousMillis = currentMillis; - } - - } }
diff -r 3a234ff1442b -r 8f1bb7191680 mbed.bld --- a/mbed.bld Thu Feb 16 16:25:31 2017 +0000 +++ b/mbed.bld Thu Apr 13 13:52:41 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/176b8275d35d \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/856d2700e60b \ No newline at end of file