Hello all,
I am having trouble getting RF modules to work using the RadioHead library. I cannot find the error for the life of me. There are no compilation errors, but when running the code I am not getting the expected serial communication.
The transmitter code:
#include <RH_ASK.h>
#include <SPI.h>
RH_ASK rf_driver(2000,11,7);
//Transmit Pin 7
void setup() {
rf_driver.init();
}
void loop() {
const char *msg = "Hello World!";
rf_driver.send((uint8_t)msg, strlen(msg));
rf_driver.waitPacketSent();
delay(50);
}
The reciever code:
#include <RH_ASK.h>
#include <SPI.h>
RH_ASK rf_driver(2000,11,7);
//Recieve Pin 11
void setup() {
rf_driver.init();
Serial.begin(9600);
}
void loop() {
uint8_t buf[12];
uint8_t buflen = sizeof(buf);
if (rf_driver.recv(buf, &buflen)) {
Serial.print("Message Revieved: ");
Serial.println((char*)buf);
}
}
When running this code with all modules connected to corect pins the attached image shows what is recieved by serial.
I cant seem to figure out why this is not working. Any help would be greatly appreciated!
Thanks, Sam