Hey,
can somebody help me, if i send a data from arduino to raspberry i see somethink is sended but failed by receiving.
here is my code:
#include<SPI.h>
#include<RF24.h>
RF24 radio(9, 10);
void setup(void) {
while(!Serial);
Serial.begin(9600);
radio.begin();
radio.setPALevel(RF24_PA_MAX);
radio.setChannel(0x76);
radio.openWritingPipe(0xF0F0F0F0E1LL);
//const uint64_t pipe = 0xE8E8F0F0E1LL;
radio.openReadingPipe(1, 0xE8E8F0F0E1LL );
radio.enableDynamicPayloads();
radio.powerUp();
}
void loop(void) {
radio.startListening();
Serial.println("Starting loop. Radio on.");
char receivedMessage[32] = {0};
if (radio.available()){
radio.read(receivedMessage, sizeof(receivedMessage));
Serial.println(receivedMessage);
Serial.println("Turning off the radio");
radio.stopListening();
String stringMessage(receivedMessage);
if (stringMessage == "GETSTRING"){
Serial.println("Looks like they want a string");
const char text[] = "Hello World";
radio.write (text, sizeof(text));
Serial.println("We sent our message");
}
}
delay(100);
}
The answer if i start the program is:
pi@raspberrypi:~/Desktop/NRF24L01 $ sudo python3 sendreceiveArduino.py
/home/pi/Desktop/NRF24L01/lib_nrf24.py:377: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
self.GPIO.setup(self.ce_pin, self.GPIO.OUT)
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 =
0xe8e8f0f0e1 0xf0f0f0f0e1
RX_ADDR_P2-5 =
0xc3
0xc4
0xc5
0xc6
TX_ADDR =
0xe8e8f0f0e1
RX_PW_P0-6 =
0x20
0x20
0x00
0x00
0x00
0x00
EN_AA =
0x3f
EN_RXADDR =
0x03
RF_CH =
0x76
RF_SETUP =
0x01
CONFIG =
0x0f
DYNPD/FEATURE =
0x3f
0x06
Data Rate = 1MBPS
Model = nRF24l01+
CRC Length = 16 bits
PA Power = PA_MIN
Sent the Message: ['G', 'E', 'T', 'S', 'T', 'R', 'I', 'N', 'G', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Received: []
Translating our received Message into unicode characters...
Our received message decodes to:
Received: []
Translating our received Message into unicode characters...
Our received message decodes to:
Timed out.
Sent the Message: ['G', 'E', 'T', 'S', 'T', 'R', 'I', 'N', 'G', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Received: []
Translating our received Message into unicode characters...
Our received message decodes to:
Received: []
Translating our received Message into unicode characters...
Our received message decodes to:
Timed out.
Thanks for helping me.
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.