ai
Dependents: ball_snatch NHK2020-arm-sub NHK2020-arm-sub NHK2020-arm-sub2 ... more
Diff: EC.h
- Revision:
- 2:670bd19af5e1
- Parent:
- 0:eb20667a5a27
- Child:
- 3:c04b12937bae
diff -r b7e957c01761 -r 670bd19af5e1 EC.h --- a/EC.h Thu Jul 04 11:40:32 2019 +0000 +++ b/EC.h Thu Jul 04 11:50:54 2019 +0000 @@ -110,7 +110,43 @@ */ 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