I'm following a project Antony Cartwright created (TUTORIAL: How to set up wireless RF (433Mhz) Transmitter & Receiver Module - Arduino! (RadioHead) - YouTube).
I've followed the instructions but modified them so that the transmitter is on Arduino and the receiver is on an 8266 (MCU ESP v12).
The code is below, and I'm getting no output on the monitor.
Would you check the code and help me get this de-bugged?
Sketch uploaded to Arduino
Transmitter
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
RH_ASK driver(2000, 9, 9, 10); // ESP8266 or ESP32: do not use pin 11
void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println("init failed");
}
void loop()
{
const char *msg = "Hello my name is Roger";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(200);
Sketch uploaded to ESP 12 (MCU 6288
Receiver
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
RH_ASK driver(2000, 0, 0, 10); // ESP8266 using pin 0 which is connected to the data pin on receiver
void setup(){
if (!driver.init())
Serial.println("init failed");
}
void loop()
{
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
if (driver.recv(buf, &buflen)) // Non-blocking
{
int i;
String str = "";
for(int i=0; i<(buflen);i++){
str += (char)buf*;*
- }*
- Serial.begin(9600);*
- Serial.println("got some characters");*
- driver.printBuffer("Got:", buf, buflen);*
- Serial.println(str);*
- }*
}