natsu tsumagari
/
test_cadenceClass
回転数計のクラスです。
Diff: main.cpp
- Revision:
- 6:93f90c5d0e5b
- Parent:
- 5:871c2d6c1129
--- a/main.cpp Sat Jan 28 01:07:59 2017 +0000 +++ b/main.cpp Sat Feb 18 07:57:27 2017 +0000 @@ -7,9 +7,13 @@ #include "Cadence.h" Cadence ar(p13,p14); +void for_attach(){ + ar.readData(); +} + int main() { -// ar.format(8, Serial::None, 1); ar.baud(115200); + ar.attach(for_attach); while(1) { pc.printf("data:"); ar.readData(); @@ -17,12 +21,11 @@ for(int i = 0; i<75; i++){ if(ar.data[i] == '\r') { pc.putc('!'); - continue; }else if(ar.data[i] == '\n'){ pc.putc('$'); - continue; + }else{ + pc.printf("%c",ar.data[i]); } - pc.printf("%c",ar.data[i]); } pc.printf("test\n\r"); pc.printf("cadence:%4.2f\n\r",ar.cadence); @@ -32,6 +35,6 @@ 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()); + wait(0.4); } }