natsu tsumagari
/
test_cadenceClass
回転数計のクラスです。
main.cpp
- Committer:
- tsumagari
- Date:
- 2017-01-28
- Revision:
- 5:871c2d6c1129
- Parent:
- 4:2def7f5f7fed
- Child:
- 6:93f90c5d0e5b
File content as of revision 5:871c2d6c1129:
#include "mbed.h" DigitalOut myled(LED1); Ticker cadenceTicker; Serial pc(USBTX,USBRX);//for debug #include "Cadence.h" Cadence ar(p13,p14); int main() { // ar.format(8, Serial::None, 1); ar.baud(115200); while(1) { pc.printf("data:"); ar.readData(); pc.printf("\n\r"); for(int i = 0; i<75; i++){ if(ar.data[i] == '\r') { pc.putc('!'); continue; }else if(ar.data[i] == '\n'){ pc.putc('$'); continue; } pc.printf("%c",ar.data[i]); } pc.printf("test\n\r"); pc.printf("cadence:%4.2f\n\r",ar.cadence); pc.printf("voltage:%4.2f\n\r",ar.voltage); pc.printf("strC:"); for(int i=0; i<4; i++) pc.printf("%c",ar.strC[i]); pc.printf("\n\rstrV:"); for(int i=0; i<4; i++) pc.printf("%c",ar.strV[i]); pc.printf("\n\r"); // pc.printf("'%s'\n\r",ar.strC.c_str()); } }