1
votes

I have an a arduino transmiter setup with the nFR24L01 transever. When I try to send data between a arduino mega and an arduino uno, the serial monitor shows garbage.

Here is my code:

Mega:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(7, 8); // CNS, CE

const byte address[6] = "00001";

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}

void loop() {
  const char text[] = "Hello World, tw";
  radio.write(&text, sizeof(text));
  delay(500);
  radio.write("what about this?",15);
  delay(500);
}

Uno:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CNS, CE
const byte address[6] = "00001";
void setup() {
  Serial.begin(9600);
  delay(1000);
  Serial.println("Hello to the world.");
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}
void loop() {
  //delay(1000);
  if (radio.available()) {
    char text[32] = "";
    radio.read(&text, 15);
    Serial.println(text);
  }
}

My Scematic Thanks in advance!

1
We need more information in order to help you. Can you post a photo or schematic of your setup?Andrue
I added a schematic to the post. Hope that helps.Eli Thorpe
The transmition is working fine. The serial monitor is the problemEli Thorpe

1 Answers

2
votes

The problem is probably the serial monitor is at a different buad rate than the code and/or the transceiver.

Try checking the serial monitor for the baud rate and set it to 9600.