0

I have a project with 7 May Deadline, i really need help on this. Here is the problem, I need to use my Arduino MEGA 2560 as transmitter and Ardino UNO(CH340G) as receiver. I can use uno as transmitter and mega as receiver , but vice versa doesn't works. I've used the tutorial on this site : https://howtomechatronics.com/tutorials/arduino/arduino-wireless-communication-nrf24l01-tutorial/

All codes, connections are same, but when i set MEGA as transmitter and uno as receiver, there is no data coming to Serial port of Uno. I really need help on this, i will be very very very grateful. Thank you so much.

Code on MEGA(transmitter)

/*
* Arduino Wireless Communication Tutorial
*     Example 1 - Transmitter Code
*                
* by Dejan Nedelkovski, www.HowToMechatronics.com
* 
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}
void loop() {
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  delay(1000);
}

Code for receiver(UNO)

/*
* Arduino Wireless Communication Tutorial
*       Example 1 - Receiver Code
*                
* by Dejan Nedelkovski, www.HowToMechatronics.com
* 
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}
void loop() {
  if (radio.available()) {
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

    PINS ON MEGA : 
    3.3 -- VCC  
    GND -- GND  
    8   -- CSN  
    7   -- CE  
    51  -- MOSI  
    52  -- SCK  
    50  -- MISO  
    PINS ON UNO :
    3.3 -- VCC  
    GND -- GND  
    8   -- CSN  
    7   -- CE  
    11  -- MOSI  
    12  -- MISO  
    13  -- SCK
  • Please show your actual wiring for both devices. Also your code would help. – Majenko May 5 at 20:58
  • I have edited my post, thank you so much i will be very grateful for all helps please. – Ahmet Yusuf Yahşi May 5 at 21:23
  • Are both your modules identical? If you swap the modules over does it start working? – Majenko May 5 at 21:26
  • I will try it now thanks for advice :D i hope it works – Ahmet Yusuf Yahşi May 5 at 21:38
  • It didn't worked , but thanks for help :D Still waiting for somone to help me btw :D i ll be very thankful if someone can , thanks a lot. – Ahmet Yusuf Yahşi May 5 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.