I've got two Arduino Pro Micros. One is wired to an RF transmitter, the other to a receiver.
Pin connections for transmitter to Pro Micro:
VCC to VCC
GND to GND
DATA to pin 5
Pin connections for receiver to Pro Micro:
VCC to VCC
GND to GND
DATA to pin 15
Code for transmitter:
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
// Create an instance of RH_ASK with the specified data pin
RH_ASK driver(2000, 15, 5); // 2000 bps, RX to pin 15 (Just any unconnected pin should work right?), TX to pin 5
void setup() {
driver.init();
Serial.begin(9600);
}
void loop() {
// message to send
const char *msg = "test";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
Serial.println("message sent");
delay(1000); // Wait for a second before sending again
}
Code for receiver:
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
// Create an instance of RH_ASK with the specified data pin for the receiver
RH_ASK driver(2000, 15); // 2000 bps, RX to pin 15
void setup() {
Serial.begin(9600); // Initialize serial communication
// Initialize the driver
if (!driver.init()) {
Serial.println("init failed");
}
}
void loop() {
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN]; // Buffer to hold received messages
uint8_t buflen = sizeof(buf);
// Check if a message is received
if (driver.recv(buf, &buflen)) {
// Print the received message
Serial.print("Message: ");
Serial.println((char*)buf);
}
}
I tried wiring the transmitter to an Arduino UNO with the default pin 12. I'm getting "message sent" in the serial monitor but not seeing anything in the serial monitor of the Pro Micro on the receiver side. And yes, I already tried both data pins on the receiver, no luck. As for range, I have a 17cm solid core copper wire connected to the antenna pin on both modules. Literally twisted the antennas together, both Arduinos being powered from my computer's USB port. Should be more than enough power.
I know both the transmitter and receiver work when using an Arduino Uno on both sides with the default pins for DATA. If I remember correctly they work when I assign a custom pin for both of them too. I will test it again to make sure if requested.






