mencari respon motor launcher dengan fungsi step
Dependencies: Motor mbed millis
Fork of transfer_function_motor by
main.cpp
- Committer:
- Najib_irvani
- Date:
- 2017-02-16
- Revision:
- 1:3a234ff1442b
- Parent:
- 0:be14d75c8037
- Child:
- 2:8f1bb7191680
File content as of revision 1:3a234ff1442b:
#include "mbed.h" #include "encoderKRAI.h" #include "Motor.h" #include "millis.h" encoderKRAI encoder( PB_13, PB_14, 14, encoderKRAI::X4_ENCODING); Serial pc(USBTX,USBRX); Motor motor(PA_8,PC_1,PC_2); unsigned long int previousMillis = 0; unsigned long int currentMillis; double rpm; int main() { startMillis(); motor.speed(0.5); while(1) { currentMillis = millis(); if (currentMillis-previousMillis>=10) { rpm = (double)encoder.getPulses(); encoder.reset(); pc.printf("%.04lf\n",rpm); previousMillis = currentMillis; } } }