![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
complete motor
Dependencies: BufferedSerial motor_sn7544
Diff: main.cpp
- Revision:
- 4:a72f75611198
- Parent:
- 3:0c6258635590
- Child:
- 5:e6f9768e1438
--- a/main.cpp Tue Jun 25 11:01:49 2019 +0000 +++ b/main.cpp Tue Jun 25 11:07:15 2019 +0000 @@ -46,16 +46,22 @@ tachoINT2.rise(&update_current); pc.attach(callback(rx_cb)); int rpm; - float distance; + float reladistance; //m단위 + float cumdistance; while(1) { flag=0; pc.printf("Enter the value for speed [-78,78]\r\n"); while(flag!=1) { - rpm=motor1.getRPM(); - distance=motor1.CalculateCumDis(); - printf("distance: %f\r\n",distance); + rpm = motor1.getRPM(); + cumdistance = motor1.CalculateCumDis(); // 누적거리 + reladistance = motor1.CalculateRelaDis(); // 상대거리 + + + printf("Rpm: %f\r\n",distance); + printf("cumdistance: %f\r\n",cumdistance); + printf("reladistance: %f\r\n",reladistance); wait(1); } // motor1.setTarget(60);