Hi guys,
Bit of a noob with all this stuff here.
Basically I have an Elegoo Uno R3 connected to an RF receiver, and a MakerHawk ATMega (Arduino Nano) connected to the transmitter.
I'm probably doing something wrong (no output on serial monitors).
I tried taking pictures but they came out terrible, so let me explain the connections.
For the Uno, I have the VCC to VCC of receiver, grnd to grnd of receiver, and RX (digital pin 0) of Uno to one of the data ports on the receiver.
For the Nano, I have VCC to VCC of transmitter (5v btw, same as uno), grnd to grnd of transmitter, and TX1 of Nano to data pin on transmitter.
I have the following receiver and transmitter
For the receiver code, I have the following:
#include <RH_ASK.h>
#ifdef RH_HAVE_HARDWARE_SPI
#include <SPI.h> // Not actually used but needed to compile
#endif
RH_ASK driver;
void setup()
{
#ifdef RH_HAVE_SERIAL
Serial.begin(9600); // Debugging only
#endif
if (!driver.init())
#ifdef RH_HAVE_SERIAL
Serial.println("init failed");
#else
;
#endif
}
void loop()
{
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
if (driver.recv(buf, &buflen)) // Non-blocking
{
// Message with a good checksum received, dump it.
driver.printBuffer("Got:", buf, buflen);
}
}
and for the transmitter code I have the following:
#include <RH_ASK.h>
#ifdef RH_HAVE_HARDWARE_SPI
#include <SPI.h> // Not actually used but needed to compile
#endif
RH_ASK driver;
void setup()
{
#ifdef RH_HAVE_SERIAL
Serial.begin(9600); // Debugging only
#endif
if (!driver.init())
#ifdef RH_HAVE_SERIAL
Serial.println("init failed");
#else
;
#endif
}
void loop()
{
const char *msg = "hello";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(200);
}
Any help would be greatly appreciated!