加速度計まで実装した相互通信動くやつ、レシーバー

Dependencies:   ADXL345_I2C mbed INA226

Fork of RS485R_2 by hiroya taura

Files at this revision

API Documentation at this revision

Comitter:
YusukeWakuta
Date:
Sat Jan 02 12:18:27 2016 +0000
Parent:
5:9e817c18440a
Commit message:
?????10?????????????????????

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 9e817c18440a -r f4c149a72dfb main.cpp
--- a/main.cpp	Sat Jan 02 07:13:43 2016 +0000
+++ b/main.cpp	Sat Jan 02 12:18:27 2016 +0000
@@ -36,13 +36,13 @@
             break;
         case 'C':
         
-    counter++;
-    if(counter > 1000){
-    counter = 0;
-    }
+    //counter++;
+   // if(counter > 1000){
+   // counter = 0;
+   // }
             Receiver = 1;
             wait_ms(3);
-            if(counter % 2 == 0){
+           // if(counter % 2 == 0){
            rs485.putc('X');
           // pc.printf("X");
             rs485.putc((signed char)acc[0]);
@@ -54,8 +54,8 @@
             rs485.putc('Z');
             //pc.printf("Z");
             rs485.putc((signed char)acc[2]);
-            }
-            else{
+            //}
+           // else{
            // pc.printf("%5d",(signed char)acc[2]);
             rs485.putc('V');
            // pc.printf("V");
@@ -65,10 +65,10 @@
             //pc.printf("C");
             rs485.putc((signed char)*Current);
             //pc.printf("%5d",(signed char)*Current);
-            }
+            //}
             //pc.printf("\n\r");
 //            rs485.printf("X%iY%iZ%i\n\r",(short)acc[0],(short)acc[1],(short)acc[2]);
-            wait_ms(2);
+            wait_ms(15);
             Receiver = 0;
             //pc.printf("x:%d,y:%d,z:%d\n\r",(signed char)acc[0],(signed char)acc[1],(signed char)acc[2]);
             break;