mbed-xbee(ATmode/pc対マイコン) ,LPS25HBの統合一段階目。 cmdの初期化が問題となっている。errorがでない。 確かめ付けました(2022/08/10)

Dependencies:   mbed LPS25HB_I2C

Files at this revision

API Documentation at this revision

Comitter:
kosukesuzuki
Date:
Wed Aug 10 10:00:16 2022 +0000
Parent:
3:c0d472625a4b
Commit message:
xbee-LPC(20220810)

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c0d472625a4b -r 0ab4ae3013ae main.cpp
--- a/main.cpp	Wed Aug 10 09:29:03 2022 +0000
+++ b/main.cpp	Wed Aug 10 10:00:16 2022 +0000
@@ -24,8 +24,8 @@
     float pressure = ps.readPressureMillibars();
     float altitude = ps.pressureToAltitudeMeters(pressure);
     float temperature = ps.readTemperatureC();
-    pc.printf("p:%.2f\t mbar\ta:%.2f m\tt:%.2f deg C\r\n",pressure,altitude,temperature);
-                
+    //pc.printf("p:%.2f\t mbar\ta:%.2f m\tt:%.2f deg C\r\n",pressure,altitude,temperature);
+    
 }
 
 
@@ -59,7 +59,7 @@
         if (xbee.readable()) pc.putc(xbee.getc());
        
         char cmd1 = xbee.getc();//cmd共有
-        char va1 = xbee.readable();//これ1にならないと一向に進まないよ
+        int va1 = xbee.readable();//これ1にならないと一向に進まないよ
         
         if(va1==1){//3 //これいいがいは永遠にまつ。
             wait_us(1);
@@ -67,7 +67,7 @@
             if(cmd1 == 'm'){//4
                 pc.printf("start\r\n");
                 t.start();
-                cmd1 = 0;
+                cmd1 = 'a';
            
                 press.attach(&pre, 1.0);
            
@@ -75,7 +75,7 @@
                     //if (pc.readable()) xbee.putc(pc.getc());
                     if (xbee.readable()) pc.putc(xbee.getc());
                     //printf("oo");
-               
+                    
                     /***********************************************************/
                     //float pressure = ps.readPressureMillibars();
                     //float altitude = ps.pressureToAltitudeMeters(pressure);
@@ -87,7 +87,7 @@
                
                     /***********************************************************/
                     char cmd2 = xbee.getc();
-                    char va2 = xbee.readable();//これ1にならないと一向に進まないよ
+                    int va2 = xbee.readable();//これ1にならないと一向に進まないよ
                     
                     //xbee.printf("%x\r\n",cmd);
                     
@@ -99,7 +99,7 @@
                             pc.printf("end\r\n");
                             pc.printf("time = %f",t.read());
                             t.stop();
-                            cmd2 = 0;
+                            cmd2 = 'a';
                    
                             return 0;