HIII
I have an arduino UNO transmit + nrf24
and 2 nano as receiver + 2*nrf24
I want to send a give ARRAY of the transmit .
transmit code:
#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>
#include <SPI.h>
RF24 radio(9,10); // Instanciation du NRF24L01
RF24Network network(radio); // Nota : "Network" utilise la librairie "radio"
// Réseau
const uint16_t noeud0 = 00; // Valeur "0" écrit au format "octal" (d'où l'autre "0" devant) uno
const uint16_t noeud1 = 01; // Valeur "1" écrit au format "octal" (d'où l'autre "0" devant)
const uint16_t noeud2 = 011; // Valeur "2" écrit au format "octal" (d'où l'autre "0" devant)
uint16_t numeroDeCeNoeud = noeud0;
uint16_t noeudCible1 = noeud1; // Ici, le noeud sera donc le "noeud0", et le noeud cible, le "noeud1"
uint16_t noeudCible2 = noeud2; // Ici, le noeud sera donc le "noeud0", et le noeud cible, le "noeud2"
typedef struct{float un1; float deux1; float troi1;} At1;
typedef struct{float un2; float deux2; float troi2;} At2;
At1 INFO1;
At2 INFO2;
void setup() {
Serial.begin(9600);
SPI.begin();
radio.begin(); // Initialisation du module NRF24
radio.setPALevel(RF24_PA_MIN); // Sélection d'un niveau "MINIMAL" pour communiquer (pas besoin d'une forte puissance, pour nos essais)
radio.setDataRate(RF24_250KBPS); // Vitesse : RF24_250KBPS, RF24_1MBPS, RF24_2MBPS
network.begin(12, numeroDeCeNoeud); // Canal 64 choisi arbitrairement (valeurs possibles : entre 0..125)
}
void loop()
{
double DONNER[16]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
INFO1.un1=DONNER[1] ;
INFO1.deux1=DONNER[5] ;
INFO1.troi1=DONNER[9] ;
INFO2.un2=DONNER[2] ;
INFO2.deux2=DONNER[6] ;
INFO2.troi2=DONNER[10] ;
network.update();
// 1ERE CARTE
RF24NetworkHeader CANAL1(noeudCible1);
network.write(CANAL1, &INFO1, sizeof(INFO1)); // On envoi à l'autre carte la valeur de l'angle souhaité, pour son servomoteur
//2EME CARTE
//delay(500);
network.update();
RF24NetworkHeader CANAL2(noeudCible2);
network.write(CANAL2, &INFO2, sizeof(INFO2));
}
1st card
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(7,8); // nRF24L01 (CE,CSN)
RF24Network network(radio); // Include the radio in the network
const uint16_t noeud0 = 00; // Valeur "0" écrit au format "octal" (d'où l'autre "0" devant) uno
const uint16_t noeud1 = 01; // Valeur "1" écrit au format "octal" (d'où l'autre "0" devant)
uint16_t numeroDeCeNoeud = noeud1;
uint16_t noeudCible0 = noeud0; // Ici, le noeud sera donc le "noeud0", et le noeud cible, le "noeud1"
typedef struct{float un1; float deux1; float troi1;} At1;
At1 INFO1;
void setup() {
Serial.begin(9600);
SPI.begin();
radio.begin();
network.begin(12, numeroDeCeNoeud); //(channel, node address)
radio.setDataRate(RF24_250KBPS);
pinMode(4, OUTPUT); // On initialise les broches D4 et D5 en sorties
pinMode(5, OUTPUT);
}
void loop() {
network.update();
while ( network.available()>0 ) { // Is there any incoming data?
RF24NetworkHeader Header1;
network.read(Header1,& INFO1, sizeof(INFO1)); // Read the incoming data
Serial.print("un = ");
Serial.println(INFO1.un1);
Serial.print("deux= ");
Serial.println(INFO1.deux1);
Serial.print("vittesse = ");
Serial.println(INFO1.troi1);
}
2nd card
/*22222222222222222222222222222222
Arduino Wireless Network - Multiple NRF24L01 Tutorial
== Node 02 (Child of Master node 00) ==
*/
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(7,8); // nRF24L01 (CE,CSN)
RF24Network network(radio); // Include the radio in the network
const uint16_t noeud0 = 00; // Valeur "0" écrit au format "octal" (d'où l'autre "0" devant) uno
const uint16_t noeud2 = 011; // Valeur "1" écrit au format "octal" (d'où l'autre "0" devant)
uint16_t numeroDeCeNoeud = noeud2;
uint16_t noeudCible0 = noeud0; // Ici, le noeud sera donc le "noeud0", et le noeud cible, le "noeud1"
typedef struct{float un2; float deux2; float troi2;} At2;
At2 INFO2;
void setup() {
Serial.begin(9600);
SPI.begin();
radio.begin();
network.begin(12, numeroDeCeNoeud); //(channel, node address)
radio.setDataRate(RF24_250KBPS);
pinMode(4, OUTPUT); // On initialise les broches D4 et D5 en sorties
pinMode(5, OUTPUT);
}
void loop() {
network.update();
while ( network.available()>0 ) { // Is there any incoming data?
RF24NetworkHeader Header2;
network.read(Header2,& INFO2, sizeof(INFO2)); // Read the incoming data
Serial.print("un= ");
Serial.println(INFO2.un2);
Serial.print("deux = ");
Serial.println(INFO2.deux2);
Serial.print("troi = ");
Serial.println(INFO2.troi2);
if I start send it:
Card one receives the info correctly, but card two receives nothing.
I switched between the first card and two, the same thing.
no hardware problem.
thank you for helping me.