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: ball_snatch NHK2020-arm-sub NHK2020-arm-sub NHK2020-arm-sub2 ... more
Ec Class Reference
increment型エンコーダ用class More...
#include <EC.h>
Inherited by Ec1multi, Ec2multi, and Ec4multi.
Public Member Functions | |
| int | getCount () const |
| double | getRad () const |
| 軸の回転角度を返す関数 | |
| double | getOmega () const |
| 軸の角速度を返す関数 | |
| void | calOmega () |
| 角速度を計算するための関数 微分を微小時間の変位として計算しているので、タイマー割込などで回さなければいけない | |
| void | setResolution (int res) |
| 分解能を指定するための関数 | |
| void | reset () |
| エンコーダのcountやωをリセットするための関数 | |
Detailed Description
increment型エンコーダ用class
SAMPLE
//プログラム例 #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 calcOmega(); int main() { int count=0; double omega; ticker.attach(&calcOmega,0.05); while(1) { count=EC.getCount(); omega=EC.getOmega(); pc.printf("count=%d,",count); pc.printf("omega=%f\r\n",omega); } } void calcOmega() { EC.calOmega(); }
1逓倍:Ec1multi 2逓倍:Ec2multi 4逓倍:Ec4multi
Definition at line 52 of file EC.h.
Member Function Documentation
| void calOmega | ( | ) |
| int getCount | ( | ) | const |
Generated on Tue Jul 12 2022 20:44:20 by
1.7.2