1

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!

3
  • We need more information in order to help you. Can you post a photo or schematic of your setup? Commented Aug 8, 2017 at 16:52
  • I added a schematic to the post. Hope that helps. Commented Aug 8, 2017 at 16:58
  • The transmition is working fine. The serial monitor is the problem Commented Aug 9, 2017 at 13:21

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! That helped me allot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.