Copy off node 1 to behave node 2
Dependencies: mbed RF24Network RF24
Diff: main.cpp
- Revision:
- 9:0736b94c8a51
- Parent:
- 7:1f768ebd2742
--- a/main.cpp Sun May 23 23:41:26 2021 +0000 +++ b/main.cpp Mon May 24 13:38:38 2021 +0000 @@ -64,6 +64,9 @@ int main() { + Init_Spi(); + Affiche_Display(this_node); + _node node; BTN1.mode(PullUp); // Resist interne Pull up @@ -119,15 +122,19 @@ payload_t payload_rx; network.read(header_rx,&payload_rx,sizeof(payload_rx)); - pc.printf("Node 01 recu de node %d, data : %d\r\n",payload_rx.src,payload_rx.data); + pc.printf("Node %d recu de node %d, data : %d\r\n",this_node,payload_rx.src,payload_rx.data); node.del = payload_rx.data; } - if(!BTN1) + if(!BTN1 || !BTN2) { + node.del++; payload_t payload_tx; payload_tx.src = this_node; - payload_tx.dest = 00; + if(!BTN1) + payload_tx.dest = 00; + if(!BTN2) + payload_tx.dest = 02; payload_tx.data = node.del%5; pc.printf("Envoi...");