Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: harurobo1006 harurobo_1026
Fork of EC by
Diff: EC.h
- Revision:
- 25:d73c40fd4b55
- Parent:
- 12:530f6184830a
- Child:
- 26:45a53e3c81b1
--- a/EC.h Tue Apr 18 04:12:19 2017 +0000
+++ b/EC.h Fri Jul 07 09:05:42 2017 +0000
@@ -96,7 +96,10 @@
* while(1){
* pc.printf(" count1=%d ",Ec1.getCount());
* pc.printf(" omega1=%f\r\n ",Ec1.getOmega());
- * if(!button) Ec1.reset(); //USERボタンを押したらリセット
+ * if(pc.readable()) {
+ * char sel=pc.getc();
+ * if(sel=='r') Ec1.reset(); //rを押したらリセット
+ * }
* }
* }
* @endcode
@@ -153,7 +156,7 @@
* #include "mbed.h"
* #include "EC.h" //ヘッダファイルをインクルード
*
- * SpeedControl motor1(PA_0,PA_1,1024,0.05,PB_8,PB_9); //エンコーダ分解能1024、角速度計算間隔を0.05秒に設定
+ * SpeedControl motor1(PA_0,PA_1,NC,1024,0.05,PB_8,PB_9); //エンコーダ分解能1024、角速度計算間隔を0.05秒に設定
* Ticker ticker; //角速度計算用ticker
* DigitalIn button(USER_BUTTON);
* Serial pc(USBTX,USBRX);
@@ -177,7 +180,10 @@
* pc.printf("omega=%f duty=%f \r\n",motor1.getOmega(),motor1.duty);
* kai=0;
* }
- * if(!button) break; //ボタンを押したら停止
+ * if(pc.readable()) {
+ * char sel=pc.getc();
+ * if(sel=='q') break; //rを押したらリセット
+ * }
* kai++;
* }
* motor1.stop();
