回転数計のクラスです。

Dependencies:   mbed

Committer:
tsumagari
Date:
Fri Jan 27 14:10:44 2017 +0000
Revision:
4:2def7f5f7fed
Parent:
3:0986b5d80ded
Child:
5:871c2d6c1129
data????strV,strC??????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsumagari 0:57308daf8dfe 1 #include "mbed.h"
tsumagari 0:57308daf8dfe 2
tsumagari 0:57308daf8dfe 3 DigitalOut myled(LED1);
tsumagari 0:57308daf8dfe 4 Ticker cadenceTicker;
tsumagari 4:2def7f5f7fed 5 Serial pc(USBTX,USBRX);//for debug
tsumagari 0:57308daf8dfe 6
tsumagari 4:2def7f5f7fed 7 #include "Cadence.h"
tsumagari 4:2def7f5f7fed 8 Cadence ar(p13,p14);
tsumagari 0:57308daf8dfe 9
tsumagari 0:57308daf8dfe 10 int main() {
tsumagari 4:2def7f5f7fed 11 // ar.format(8, Serial::None, 1);
tsumagari 4:2def7f5f7fed 12 ar.baud(115200);
tsumagari 0:57308daf8dfe 13 while(1) {
tsumagari 4:2def7f5f7fed 14 pc.printf("data:");
tsumagari 4:2def7f5f7fed 15 ar.readData();
tsumagari 4:2def7f5f7fed 16 pc.printf("\n\r");
tsumagari 4:2def7f5f7fed 17 for(int i = 0; i<75; i++){
tsumagari 4:2def7f5f7fed 18 if(ar.data[i] == '\r') {
tsumagari 4:2def7f5f7fed 19 pc.putc('!');
tsumagari 4:2def7f5f7fed 20 continue;
tsumagari 4:2def7f5f7fed 21 }else if(ar.data[i] == '\n'){
tsumagari 4:2def7f5f7fed 22 pc.putc('$');
tsumagari 4:2def7f5f7fed 23 continue;
tsumagari 4:2def7f5f7fed 24 }
tsumagari 4:2def7f5f7fed 25 pc.printf("%c",ar.data[i]);
tsumagari 4:2def7f5f7fed 26 }
tsumagari 0:57308daf8dfe 27 pc.printf("test\n\r");
tsumagari 4:2def7f5f7fed 28 pc.printf("cadence: %d\n\r",ar.cadence);
tsumagari 4:2def7f5f7fed 29 pc.printf("voltage: %d\n\r",ar.voltage);
tsumagari 4:2def7f5f7fed 30 pc.printf("strC:");
tsumagari 4:2def7f5f7fed 31 for(int i=0; i<4; i++) pc.printf("%c",ar.strC[i]);
tsumagari 4:2def7f5f7fed 32 pc.printf("\n\rstrV:");
tsumagari 4:2def7f5f7fed 33 for(int i=0; i<4; i++) pc.printf("%c",ar.strV[i]);
tsumagari 4:2def7f5f7fed 34 pc.printf("\n\r");
tsumagari 4:2def7f5f7fed 35 // pc.printf("'%s'\n\r",ar.strC.c_str());
tsumagari 0:57308daf8dfe 36 }
tsumagari 4:2def7f5f7fed 37 }