Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

FEATHER RFM69HCW-MULTIPLE SERVERS
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

FEATHER RFM69HCW-MULTIPLE SERVERS

by williamlynn on Sun Jan 16, 2022 7:23 pm

I am using FEATHER RFM69HCW modules and one of the FEATHERS(CLIENT)has three pushbuttons which transmit button pushed to the other two FEATHERS(SERVERS). It is important to send the signal to both SERVERS at the same time. The code I have attached works but there is a delay between when the servers get the signal. The code is using addressing with encryption disabled. The total code is attached but the problem area is here(Lines 179-241). Most of the code is from RADIOHEAD examples.


"both = digitalRead(both_pin);
//Serial.print("both_pin = ");Serial.println(both);
if (both == LOW)
{
char radiopacket[20] = "both_pin";
itoa(packetnum++, radiopacket+13, 10);
Serial.print("Sending both_pin "); Serial.println(radiopacket);

// Send a message!
if (rf69_manager.sendtoWait((uint8_t *)radiopacket, strlen(radiopacket), DEST_ADDRESS_L))

{
// Now wait for a reply from the server
uint8_t len = sizeof(buf);
uint8_t from;
if (rf69_manager.recvfromAckTimeout(buf, &len, 2000, &from))
{
buf[len] = 0; // zero out remaining string

//Serial.print("Got reply from #"); Serial.print(from);
//Serial.print(" [RSSI :");
//Serial.print(rf69.lastRssi());
//Serial.print("] : ");
//Serial.println((char*)buf);
//Blink(LED, 40, 3); //blink LED 3 times, 40ms between blinks
}
else
{
Serial.println("No reply, is anyone listening?");
}
}
else
{
Serial.println("Sending failed (no ack)");
}

if (rf69_manager.sendtoWait((uint8_t *)radiopacket, strlen(radiopacket), DEST_ADDRESS_H))

{
// Now wait for a reply from the server
uint8_t len = sizeof(buf);
uint8_t from;
if (rf69_manager.recvfromAckTimeout(buf, &len, 2000, &from))
{
buf[len] = 0; // zero out remaining string

//Serial.print("Got reply from #"); Serial.print(from);
//Serial.print(" [RSSI :");
//Serial.print(rf69.lastRssi());
//Serial.print("] : ");
//Serial.println((char*)buf);
//Blink(LED, 40, 3); //blink LED 3 times, 40ms between blinks
}
else
{
Serial.println("No reply, is anyone listening?");
}
}
else
{
Serial.println("Sending failed (no ack)");
}
}
Attachments
PICKLE_RadioHead69_AddrDemo_TX.ino
(7.47 KiB) Downloaded 2 times

williamlynn
 
Posts: 64
Joined: Fri Dec 17, 2010 5:51 pm

Please be positive and constructive with your questions and comments.