FN

Dependencies:   mbed RF24Network RF24

Revision:
7:1b47a2b6329a
Parent:
6:d46e3c0c8d35
Child:
8:b0775f476afc
diff -r d46e3c0c8d35 -r 1b47a2b6329a main.cpp
--- a/main.cpp	Mon Mar 25 16:34:59 2019 +0000
+++ b/main.cpp	Thu Mar 28 10:32:50 2019 +0000
@@ -14,8 +14,8 @@
 float temperature;
 float vitesse;
 
-const int n = 2;
-int addr[n] = {001,001};
+const int n = 3;
+int addr[n] = {01,02,03};
 float d[n];
 int indice=0;
 
@@ -35,14 +35,14 @@
 RF24Network network(radio);
  
 // Address of our node
-const uint16_t this_node = 01;
+const uint16_t this_node = 00;
  
 // Address of the other node
 const uint16_t other_node1 = 00;
 const uint16_t other_node2 = 001;
  
 // How often to send payload packet to the other unit
-const unsigned long interval = 500; //ms
+const unsigned long interval = 1000; //ms
  
 // When did we last send?
 unsigned long last_sent;
@@ -115,18 +115,18 @@
     wait_ms(2000);
     t.start();
     t_packet.start();
-    temperature = 0;
-    for (int i=0;i<10;i++) {
-        temperature += LM35.read();
-        wait_ms(10);
-    }
+   // temperature = 25;
+//    for (int i=0;i<10;i++) {
+//        temperature += LM35.read();
+//        wait_ms(10);
+//    }
     
     
     
     
-    temperature = temperature*34;
+  //  temperature = temperature*34;
     
-    vitesse = 331.5 + 0.595*temperature;
+    vitesse = 342.0;//331.5 + 0.595*temperature;
     
     button.rise(&pressed);
     while(1) 
@@ -139,7 +139,7 @@
         unsigned long now = t.read_ms();
         if ( now >= interval  ) 
         {
-            if(indice > 1) {
+            if(indice > 2) {
                 for(int j=0; j<n; j++)
                     printf("distance %d = %f\r\n",j+1,d[j]);
                 indice = 0;