Go Down

Topic: PLEASE HELP: Mirf won't loop (Read 237 times) previous topic - next topic

supermancrb

Hi All,
      New to the forums, please help.  Using nRF24L01 radios.  Code is below.  Sender only goes through the loop one time, then stops.  Output of the Serial looks like this:

"Beginning...
end"

Receiver output shows one instance of the message sent. 

Then the sender stops, instead of saying "end" multiple times.  What gives?  Code below.  Thank you!


Send Code (arduino uno+ethernet shield):

Code: [Select]
#include<SPI.h>
#include<Mirf.h>
#include<nRF24L01.h>
#include<MirfHardwareSpiDriver.h>

void setup() {
 Serial.begin(9600);
Mirf.spi=&MirfHardwareSpi;
Mirf.csnPin=10;
Mirf.cePin=9;
Mirf.init();
Mirf.setTADDR((byte *)"serv1");
Mirf.payload=32;
Mirf.config();
Serial.println("Beginning...");
}

void loop() {
  Mirf.send((byte *)"12345");
  delay(500);
  Serial.println("end");
}


Receiver Code (arduino micro):

Code: [Select]
  #include<SPI.h>
#include<Mirf.h>
#include<nRF24L01.h>
#include<MirfHardwareSpiDriver.h>

void setup() {
 Serial.begin(9600);
Mirf.spi=&MirfHardwareSpi;
Mirf.csnPin=10;
Mirf.cePin=9;
Mirf.init();
Mirf.setTADDR((byte *)"serv1");
Mirf.payload=32;
Mirf.config();
Serial.println("Beginning...");
}

void loop(){
  byte data[32];
  if(!Mirf.isSending() && Mirf.dataReady()){
    Serial.println("Got Packet");
    Mirf.getData((byte *) &data);
    Serial.write(byte(data[0]));
    Serial.write(byte(data[1]));
    Serial.write(byte(data[2]));
    Serial.write(byte(data[3]));
    Serial.write(byte(data[4]));
    Serial.println("");
  }
}

Go Up