aaaaaaaaaa

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
sakanakuuun
Date:
Thu Sep 01 08:53:14 2016 +0000
Parent:
0:f12d257b587e
Commit message:
fnaklnsflksopeugjpv9shid; ; ;

Changed in this revision

locate.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f12d257b587e -r 10cc86cabdce locate.h
--- a/locate.h	Thu Sep 01 05:13:31 2016 +0000
+++ b/locate.h	Thu Sep 01 08:53:14 2016 +0000
@@ -30,7 +30,7 @@
 Serial pc(SERIAL_TX, SERIAL_RX);
 TIM_Encoder_InitTypeDef encoder1, encoder2;
 TIM_HandleTypeDef  timer1,  timer2;
-DigitalOut enc_v(PB_10);
+DigitalOut enc_v(PC_7);
 
 uint16_t count1=0,  count2=0;
 int8_t dir1, dir2;
@@ -72,7 +72,7 @@
     count2=__HAL_TIM_GET_COUNTER(&timer2);
     dir2 = __HAL_TIM_IS_TIM_COUNTING_DOWN(&timer2);   
     
-    r = convert_enc_count(count1, dir1);
+    r = -convert_enc_count(count1, dir1);
     l = convert_enc_count(count2, dir2);
         
     theta = (r - l) * ROUND;
@@ -83,8 +83,8 @@
 
     pr = r;
     pl = l;
-    pc.printf("count1:%d%s  count2:%d%s\r\n", count1, dir1==0 ? "+":"-",count2, dir2==0 ? "+":"-");
-    pc.printf("right:%d     left:%d", r, l);
+    //pc.printf("count1:%d%s  count2:%d%s\r\n", count1, dir1==0 ? "+":"-",count2, dir2==0 ? "+":"-");
+    pc.printf("right:%d     left:%d    ", r, l);
 }
 
 short coordinateX()
diff -r f12d257b587e -r 10cc86cabdce main.cpp
--- a/main.cpp	Thu Sep 01 05:13:31 2016 +0000
+++ b/main.cpp	Thu Sep 01 08:53:14 2016 +0000
@@ -6,6 +6,8 @@
     setup();
 
     while(1) {
+        pc.printf("a");
         update();
+        pc.printf("x:%d     y:%d    t:%f\r\n", coordinateX(), coordinateY(), coordinateTheta());
     }
 }