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)");
}
}
FEATHER RFM69HCW-MULTIPLE SERVERS
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- williamlynn
- Posts: 74
- Joined: Fri Dec 17, 2010 5:51 pm
FEATHER RFM69HCW-MULTIPLE SERVERS
- Attachments
-
[The extension ino has been deactivated and can no longer be displayed.]
Please be positive and constructive with your questions and comments.