I am using RF modules like RF transmitter and RF receiver for learning purpose to send message we need microcontroller to controls them so i use ESP8266MOD for RF transmitter and Arduino nano for RF receiver but when i send a simple message it does not sending .......I am using RF library called radiohead i added more debug in my code as well as radiohead library files.

Heres the RF transmitter code that was connected to ESP8266:

#include <RH_ASK.h>
#include <SPI.h>

RH_ASK driver(2000, 11, 2, 10, false);

void setup() {
    Serial.begin(9600);
    Serial.println("Starting setup...");

    // if (!driver.init()) {
    //     Serial.println("RH_ASK init failed");
    // } else {
    //     Serial.println("RH_ASK init success");
    // }

    Serial.println("Setup complete");
}

void loop() {
    const char *msg = "Hello World!";
    
    Serial.print("Sending message: ");
    Serial.println(msg);
    
    driver.send((uint8_t *)msg, strlen(msg));

    Serial.println("Waiting for packet to be sent...");
    driver.waitPacketSent();

    Serial.println("Message sent. Waiting for 1000 ms...");
    delay(1000);
}

OUTPUT:

Starting setup...
Setup complete
Sending message: Hello World!
Inside RH_ASK::send
Byte count: 19
Encoded message: E 15 34 34 34 34 D D D D 16 23 1A 19 1A 2A 1A 2A 1A 34 13 D 19 1C 1A 34 1C 13 1A 2A 1A 16 13 E 
Sending symbols: 2A 2A 2A 2A 2A 2A 38 2C E 15 34 34 34 34 D D D D 16 23 1A 19 1A 2A 1A 2A 1A 34 13 D 19 1C 1A 34 1C 13 1A 2A 1A 16 13 E 2C 34 2A 29 
Exiting RH_ASK::send
Waiting for packet to be sent...

Heres my RF receivers code that was connected to a arduino nano:

#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile

RH_ASK driver;

void setup()
{
    Serial.begin(9600); // Debugging only
    if (!driver.init())
      Serial.println("init failed");

    Serial.println("init success");
}

void loop()
{
    uint8_t buf[12];
    uint8_t buflen = sizeof(buf);
    if (driver.recv(buf, &buflen)) // Non-blocking
    {
      int i;
      // Message with a good checksum received, dump it.
      Serial.print("Message: ");
      Serial.println((char*)buf);         
    }
}


OUTPUT:

init success
0

There are 0 best solutions below