reçoive les donées ... nique sa mére

Dependencies:   mbed RF24Network RF24

Revision:
6:4840dd0ef133
Parent:
5:ddab03ae19aa
--- a/main.cpp	Thu Feb 14 10:57:11 2019 +0000
+++ b/main.cpp	Mon Apr 01 11:52:07 2019 +0000
@@ -1,58 +1,58 @@
 #include "mbed.h"
 #include <RF24Network.h>
 #include <RF24.h>
-
+ 
 Serial pc(USBTX, USBRX);
-InterruptIn button(D8);
-
+InterruptIn button(D4);
+ 
 PwmOut mypwm(D5);
-
+ 
 RF24 radio(SPI_MOSI, SPI_MISO, SPI_SCK, D9, SPI_CS );
-
+ 
 // Network uses that radio
 RF24Network network(radio);
-
+ 
 // Address of our node
-const uint16_t this_node = 00;
-
+const uint16_t this_node = 03;
+ 
 // Address of the other node
-const uint16_t other_node = 01;
-
+const uint16_t other_node = 00;
+ 
 // When did we last send?
 unsigned long last_sent;
-
+ 
 // How many have we sent already
 unsigned long packets_sent;
-
+ 
 // Structure of our payload
 struct payload_t 
 {
     unsigned long ms;
     unsigned long counter;
 };
-
+ 
 //interruption du NRF24
 void pressed()
 {
     mypwm.write(0.5);
 }
-
+ 
 int main()
 {
     button.enable_irq();
     button.rise(&pressed);
-    mypwm.period_us(30);
-    mypwm.pulsewidth_us(15);
+    mypwm.period_us(40);
+    mypwm.pulsewidth_us(20);
     mypwm.write(0.0);
     
     pc.baud(115200);
-    wait_ms(1000);
-
+    wait_ms(500);
+ 
     pc.printf("mBed RF24Network node\n");
     radio.begin();
     network.begin(/*channel*/ 90, /*node address*/ this_node);
-    wait_ms(2000);
-
+    wait_ms(1000);
+ 
     while(1) 
     {
         // Pump the network regularly
@@ -67,10 +67,11 @@
             network.read(header_rx,&payload_rx,sizeof(payload_rx));
             pc.printf("Received packet # %d at %d ms\r\n",payload_rx.counter,payload_rx.ms);
             
-            wait_ms(2);
+            wait_us(1750);
             mypwm.write(0.0);
         }
-
+ 
     }
-
-}
\ No newline at end of file
+ 
+}   
+   
\ No newline at end of file