a

Dependents:   4thcomp 6th33222_copy

Fork of Locate by Tk A

Revision:
10:d88fe87720d2
Parent:
9:69fe7b8350c6
--- a/locate.cpp	Fri Sep 16 08:48:12 2016 +0000
+++ b/locate.cpp	Sat Sep 17 23:20:49 2016 +0000
@@ -5,13 +5,13 @@
 
 
 /********以下グローバル変数宣言**************/
-
+Serial pc(SERIAL_TX, SERIAL_RX); 
 TIM_Encoder_InitTypeDef encoder1, encoder2;     //Encoderライブラリで使う
 TIM_HandleTypeDef  timer1,  timer2;             //Encoderライブラリで使う
 uint16_t count1=0,  count2=0;                   //Encoderライブラリで使う
 int8_t   dir1, dir2;                            //Encoderライブラリで使う
 
-Serial pc(SERIAL_TX, SERIAL_RX);    //pcと通信
+
 DigitalOut enc_v(PC_7);             //エンコーダの電源
 
 int     r, l;                  //現在の回転数
@@ -82,7 +82,7 @@
     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     x:%d    y:%d    t:%f\n\r", r, l, coordinateX(), coordinateY(), coordinateTheta());
+    pc.printf("right:%d     left:%d     x:%d    y:%d    t:%f   d%d\n\r", r, l, coordinateX(), coordinateY(), coordinateTheta(),r-l);
 }
 
 void update_np()
@@ -103,6 +103,7 @@
 
     pr = r;
     pl = l;
+    pc.printf("right:%d     left:%d     x:%d    y:%d    t:%f   d%d\n\r", r, l, coordinateX(), coordinateY(), coordinateTheta(),r-l);
 }
 
 int coordinateX()