I tried to configure two nRF24L01 modules with an arduino uno and an r-pi 400 keyboard like this: I connected the two modules, one to the arduino, one to the r-pi and I put code on the arduino, and on the r-pi I ran a python code. I tried to make the arduino send messages, and the r-pi receive them and display them in the terminal, but I didn't succeed. Both modules are detected by the r-pi and the arduino and the arduino shows me that it is sending the messages, but the r-pi always has an empty reception buffer. What can i do?
cod r-pi:
from RF24 import RF24, RF24_PA_LOW, RF24_1MBPS
import time
# Setup RF24 on CE=25, CSN=8 (SPI CE0)
radio = RF24(25, 0)
pipe = 0xE6E6E6E67A # trebuie să fie aceeași cu cea de pe Arduino
def setup():
if not radio.begin():
raise RuntimeError("NRF24L01 nu a fost detectat!")
radio.setPALevel(RF24_PA_LOW)
radio.setDataRate(RF24_1MBPS)
radio.setChannel(76)
radio.openReadingPipe(1, pipe)
radio.setAutoAck(False)
radio.startListening()
print("Receptor gata, aștept pachete...\n")
def loop():
while True:
if radio.available():
received = []
radio.read(received, radio.getDynamicPayloadSize())
print("Pachet primit:", received)
time.sleep(0.1)
if _name_ == '_main_':
setup()
loop()
code arduino:
#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(9, 10); // CE, CSN
const uint64_t pipe = 0xE6E6E6E6E67A; // Adresa de transmisie
int message[1];
void setup() {
Serial.begin(9600);
radio.begin();
radio.setPALevel(RF24_PA_LOW); // sau RF24_PA_MAX dacă ai antenă
radio.setDataRate(RF24_1MBPS); // să fie compatibil cu sniffer-ul
radio.setAutoAck(false); // dezactivează ACK (sniffer nu răspunde)
radio.openWritingPipe(pipe);
radio.stopListening();
}
void loop() {
message[0] = 111;
bool success = radio.write(&message, sizeof(message));
if (success) {
Serial.println("Trimis: 111");
} else {
Serial.println("Eroare la trimitere!");
}
delay(500);
}

