natsu tsumagari
/
test_cadenceClass
回転数計のクラスです。
main.cpp
- Committer:
- tsumagari
- Date:
- 2017-01-27
- Revision:
- 4:2def7f5f7fed
- Parent:
- 3:0986b5d80ded
- Child:
- 5:871c2d6c1129
File content as of revision 4:2def7f5f7fed:
#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: %d\n\r",ar.cadence); pc.printf("voltage: %d\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()); } }