cuma coba publish ya
Dependencies: mbed encoderKRAI
Diff: main.cpp
- Revision:
- 0:cb94be0bdb13
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 12 09:25:41 2019 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "encoderKRAI.h" + +Serial pc(USBTX, USBRX); +double theta ; +double pulse; + +encoderKRAI enc_shagai(PC_6, PC_7, 538, encoderKRAI::X4_ENCODING); + +void hitungParameter(){ + pulse=(double) enc_shagai.getPulses()*360/538; + enc_shagai.reset(); + theta+=pulse; + pc.printf("theta = %.2f\t\n", theta ); +} + +int main (){ + while(1){ + hitungParameter(); + } + } \ No newline at end of file