mbed-xbee(ATmode/pc対マイコン) ,LPS35HBの統合一段階目。 cmdの初期化が問題となっている。

Dependencies:   mbed LPS25HB_I2C

main.cpp

Committer:
kosukesuzuki
Date:
2022-08-02
Revision:
0:5ffa13919073
Child:
1:d7561bf65def

File content as of revision 0:5ffa13919073:

#include "mbed.h"

Timer t;

Serial pc(USBTX, USBRX); // tx, rx
Serial xbee(PA_9, PA_10); // tx, rx

int main() {
    
    pc.printf("\rbegin\r");
 
    for (;;) {
        //if (pc.readable()) xbee.putc(pc.getc());
        if (xbee.readable()) pc.putc(xbee.getc());
        wait_us(1);
        
        char cmd = xbee.getc();
        if(cmd == 'm'){
            pc.printf("start\r\n");
            t.start();
            cmd = 0;
            }
            
        if(cmd == 'n'){
            pc.printf("end\r\n");
            pc.printf("time = %f",t.read());
            t.stop();
            cmd = 0;
            return 0;
            }
    }
}