Yudai Suzuki / Mbed 2 deprecated sekkeiseisaku_week4

Dependencies:   mbed QEI

Files at this revision

API Documentation at this revision

Comitter:
uchikimi
Date:
Fri Nov 16 03:52:02 2018 +0000
Parent:
0:67b5faeb3720
Child:
2:6173078c34ef
Commit message:
??????;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Nov 09 03:56:27 2018 +0000
+++ b/main.cpp	Fri Nov 16 03:52:02 2018 +0000
@@ -2,7 +2,7 @@
 #include "mbed.h"
 #include "RawSerial.h"
 RawSerial pc(P5_0,P5_1); // tx, rx (ポートの指定)
-//RawSerial pc(USBTX,USBRX); // tx, rx(USBシリアルポートの指定)
+RawSerial pcm(USBTX,USBRX); // tx, rx(USBシリアルポートの指定)
 
 
 #define ROTATE_PER_REVOLUTIONS  360 //1回転でのパルス数
@@ -19,6 +19,7 @@
 //BusOut input(D6,D5);
 
 Ticker msec;                //繰り返しタイマ割り込みmsecを定義
+Timer time1;                //時間タイマー
 
 double r=0;                 //目標値
 double y,e,old_e,u;         //現在値,エラー値,1つ前のエラー値,
@@ -52,17 +53,17 @@
 
 int main()
 {
-    //pc.baud(115200);                                    //ボーレートの指定(通信速度)
+    pcm.baud(921600);                                    //ボーレートの指定(通信速度)
     pc.baud(921600);                                    //ボーレートの指定
     Servo1.period(0.00001);                                //PWMの周期の指定
     Servo2.period(0.00001);                                //PWMの周期の指定
     msec.attach_us(&pid,T);                             //タイマ割り込みの指定
+    time1.start();
 
     while(1) {
 
         //pc.printf("(%-10f)¥0",y);                       //エンコーダ値(角度)の送信(serial)
-
-
+        pcm.printf("%d\t%-10f\t%-10f\r\n",time1.read_ms(),y,u);//時間,エンコーダ値(角度)の送信(serial)(t,y,u)
 
         /********************************************************************/
         /************************シリアル通信受信部*****************************/
@@ -113,6 +114,8 @@
         /********************************************************************/
 
     }
+    time1.stop();
+    time1.reset();
 }
 
 
--- a/mbed.bld	Fri Nov 09 03:56:27 2018 +0000
+++ b/mbed.bld	Fri Nov 16 03:52:02 2018 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/fd96258d940d
\ No newline at end of file