V1

Dependencies:   BufferedSerial sn7544

Fork of GPG_motor by Kang mingyo

Files at this revision

API Documentation at this revision

Comitter:
kangmingyo
Date:
Tue Jun 25 11:07:15 2019 +0000
Parent:
3:0c6258635590
Child:
5:e6f9768e1438
Commit message:
value update

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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);