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

Dependencies:   mbed LPS25HB_I2C

Committer:
kosukesuzuki
Date:
Tue Aug 02 10:44:00 2022 +0000
Revision:
0:5ffa13919073
Child:
1:d7561bf65def
mbed-xbee(ATmode)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kosukesuzuki 0:5ffa13919073 1 #include "mbed.h"
kosukesuzuki 0:5ffa13919073 2
kosukesuzuki 0:5ffa13919073 3 Timer t;
kosukesuzuki 0:5ffa13919073 4
kosukesuzuki 0:5ffa13919073 5 Serial pc(USBTX, USBRX); // tx, rx
kosukesuzuki 0:5ffa13919073 6 Serial xbee(PA_9, PA_10); // tx, rx
kosukesuzuki 0:5ffa13919073 7
kosukesuzuki 0:5ffa13919073 8 int main() {
kosukesuzuki 0:5ffa13919073 9
kosukesuzuki 0:5ffa13919073 10 pc.printf("\rbegin\r");
kosukesuzuki 0:5ffa13919073 11
kosukesuzuki 0:5ffa13919073 12 for (;;) {
kosukesuzuki 0:5ffa13919073 13 //if (pc.readable()) xbee.putc(pc.getc());
kosukesuzuki 0:5ffa13919073 14 if (xbee.readable()) pc.putc(xbee.getc());
kosukesuzuki 0:5ffa13919073 15 wait_us(1);
kosukesuzuki 0:5ffa13919073 16
kosukesuzuki 0:5ffa13919073 17 char cmd = xbee.getc();
kosukesuzuki 0:5ffa13919073 18 if(cmd == 'm'){
kosukesuzuki 0:5ffa13919073 19 pc.printf("start\r\n");
kosukesuzuki 0:5ffa13919073 20 t.start();
kosukesuzuki 0:5ffa13919073 21 cmd = 0;
kosukesuzuki 0:5ffa13919073 22 }
kosukesuzuki 0:5ffa13919073 23
kosukesuzuki 0:5ffa13919073 24 if(cmd == 'n'){
kosukesuzuki 0:5ffa13919073 25 pc.printf("end\r\n");
kosukesuzuki 0:5ffa13919073 26 pc.printf("time = %f",t.read());
kosukesuzuki 0:5ffa13919073 27 t.stop();
kosukesuzuki 0:5ffa13919073 28 cmd = 0;
kosukesuzuki 0:5ffa13919073 29 return 0;
kosukesuzuki 0:5ffa13919073 30 }
kosukesuzuki 0:5ffa13919073 31 }
kosukesuzuki 0:5ffa13919073 32 }