NRF24L01 doesn't work anymore... could be for my code?

hi. i am quite a newbie in this ... i've been testing yesterday my arduino nano with the nrf24l01 module... i've made a code to send and receive at the same time... SEND when a button is pressed, and receive periodically.

suddenly the wifi module stopped working, i m pretty sure about that cause i swap it with a new one... and the system is working again.

i am aware now to have overloaded the system

this is my code

#include "nRF24L01.h"  
#include "RF24.h"
#include "SPI.h"
#include "U8glib.h"

U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); 


int ReceivedMessage[1] = {000}; 
int SentMessage[1] = {000};

RF24 radio(9,10); 

const uint64_t pipe = 0xE6E6E6E6E6E6;  

void setup(){
  Serial.begin(9600);
  pinMode(7, INPUT);  
  pinMode(8, INPUT);  
  pinMode(2, OUTPUT);     
  
  digitalWrite(8,HIGH); 
  digitalWrite(7,HIGH);   
   
  radio.begin();  // Start the NRF24L01
  radio.openWritingPipe(pipe);  // Get NRF24L01 ready to transmit
  radio.openReadingPipe(1,pipe);  // Get NRF24L01 ready to receive
    
}

void loop(){
    delay(20);
    
  if (digitalRead(8) == LOW){  // If Switch is Activated
    SentMessage[0] = 111;
    radio.write(SentMessage, 1);
  }
  if (digitalRead(8) == HIGH){  // If Switch is Activated
    SentMessage[0] = 000;
    radio.write(SentMessage, 1);  //  Send value through NRF24L01
  }

  if (digitalRead(7) == LOW){  // If Switch is Activated
    SentMessage[0] = 001;
    radio.write(SentMessage, 1);
  }
  if (digitalRead(7) == HIGH){  // If Switch is Activated
    SentMessage[0] = 010;
    radio.write(SentMessage, 1);  //  Send value through NRF24L01
  }
controllaConnessione();
}

void suona() {
  tone(2, 1500); // Send 1KHz sound signal...
  delay(200);        // ...for 1 sec
  noTone(2); 
}

void scriviConnesso() {
  u8g.firstPage();  
  do {
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(10, 20); 
  u8g.print("CONNESSO");
    } while( u8g.nextPage() );

}

void scriviNonConnesso() {
  u8g.firstPage();  
  do {
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(10, 20); 
  u8g.print("NON CONNESSO");
    } while( u8g.nextPage() );

}

void controllaConnessione() {

radio.startListening();  //  Listen to see if information received
delay(100);
  if (radio.available()) {
    radio.read(ReceivedMessage, 1);  // Read information from the NRF24L01
    if (ReceivedMessage[0] == 100) {
      suona();
      } 
   if (ReceivedMessage[0] == 251) {Serial.println("RISPOSTO"); scriviConnesso();} 
                                  else {Serial.println("NON RISPOSTO");scriviNonConnesso();}          
    }
   else {Serial.println("NON RISPOSTO");scriviNonConnesso();}    
delay(100);
radio.stopListening();  

}

please let me know what u think

thank you

This is a bit confusing. An nRF24L01+ module is not WiFi, You must have two Arduinos and two nRF24s and two programs - but you have only posted one program.

I don't know what the U8glib library is for or how it works. It is possible that it interferes with the nRF24.

Try to get your nRF24s working with one of the pairs of examples in this Simple nRF24L01+ Tutorial

When it is working you could then add code for U8glib stuff and see what happens.

...R

probably i didn’t explain it very well

now my code is working, on both arduino.
the problem is that if i substitute the NRF24L01 module with the old one… it doesnt work anymore… so i guess the old module is broken.

now my question is:
is it possible that i broke it using the code i pasted?
i dont know… maybe i am over loading it…

thank you

komarek: is it possible that i broke it using the code i pasted?

I don't think there is any way that code could break it.

I presume you are powering it with 3.3v rather than 5v?

...R

yes of course 3.3V following the instructions to plug it for RF24 Library

so i guess the piece was faulty when i bought it