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.
Diff: EC.h
- Revision:
- 5:4e39c821be9c
- Parent:
- 4:d1c16f9877b6
- Child:
- 6:8eaadd1e43f1
--- a/EC.h Thu Jul 04 12:05:52 2019 +0000
+++ b/EC.h Thu Jul 04 12:11:31 2019 +0000
@@ -4,6 +4,45 @@
#ifndef M_PI
#define M_PI 3.14159265359f
#endif
+
+/**@section SAMPLE
+@code
+//プログラム例
+* #include "mbed.h"
+* #include "EC.h"
+*
+* #define RESOLUTION 500
+* Ticker ticker;
+* Serial pc(USBTX,USBRX);
+*
+* //(A層,B層,分解能)
+* Ec1multi EC(p7,p8,RESOLUTION); //1逓倍用class
+* //or
+* //Ec2multi EC(p7,p8,RESOLUTION); //2逓倍用class
+* //or
+* //Ec4multi EC(p7,p8,RESOLUTION); //4逓倍用class
+* void calOmega();
+*
+* int main()
+* {
+* int count=0;
+* double omega;
+* ticker.attach(&calOmega,0.05);
+*
+* while(1) {
+* count=EC.getCount();
+* omega=EC.getOmega();
+* pc.printf("count=%d,",count);
+* pc.printf("omega=%f\r\n",omega);
+* }
+* }
+* void calOmega()
+* {
+* EC.calOmega();
+* }
+* @endcode
+*/
+
/**
* @brief increment型エンコーダ用class
* @details 1逓倍:Ec1multi
@@ -31,24 +70,24 @@
*/
Ec(int res,int multi);
/**@fn int getCount()
- エンコーダのcountを返す関数
- 1周のcount=分解能×逓倍
- @return count
+ * エンコーダのcountを返す関数
+ * 1周のcount=分解能×逓倍
+ * @return count
*/
int getCount();
/**
- 軸の角速度を返す関数
- @return ω(rad/s)
+ * 軸の角速度を返す関数
+ * @return ω(rad/s)
*/
double getOmega();
/**
- 角速度を計算するための関数
- 微分を微小時間の変位として計算しているので、タイマー割込などで回さなければいけない
+ * 角速度を計算するための関数
+ * 微分を微小時間の変位として計算しているので、タイマー割込などで回さなければいけない
*/
void calOmega();
/**
- 分解能を指定するための関数
- @param res エンコーダの分解能
+ * 分解能を指定するための関数
+ * @param res エンコーダの分解能
*/
void setResolution(int res);
///エンコーダのcountやωをリセットするための関数
@@ -112,43 +151,7 @@
*/
Ec4multi(PinName signalA,PinName signalB,int res);
};
-/**@section SAMPLE
-@code
-//プログラム例
-#include "mbed.h"
-#include "EC.h"
-#define RESOLUTION 500
-Ticker ticker;
-Serial pc(USBTX,USBRX);
-
-//(A層,B層,分解能)
-Ec1multi EC(p7,p8,RESOLUTION); //1逓倍用class
-//or
-//Ec2multi EC(p7,p8,RESOLUTION); //2逓倍用class
-//or
-//Ec4multi EC(p7,p8,RESOLUTION); //4逓倍用class
-void calOmega();
-
-int main()
-{
- int count=0;
- double omega;
- ticker.attach(&calOmega,0.05);
-
- while(1) {
- count=EC.getCount();
- omega=EC.getOmega();
- pc.printf("count=%d,",count);
- pc.printf("omega=%f\r\n",omega);
- }
-}
-void calOmega()
-{
- EC.calOmega();
-}
-@endcode
-*/
#endif
\ No newline at end of file