I have a basic question. When I execute the lines shown below, it always prints "Transmit Failed". This means the if statement executed the else clause. This is true even with the unaltered code from LowPowerLab. However, the radio does send the message.
What is the if statement doing? My assumption was that it checks to make sure the radio.send worked but obviously that is not true.
if (radio.sendWithRetry(HOSTID, volt_char, sendSize))
Serial.println("Transmit OK");
else Serial.println("Transmit Failed.");
Also, is there documentation on these commands somewhere?
volt_char would better be a byte pointer to a byte/char array.
Second make sure you can send with the Gateway and Node (http://github.com/lowpowerlab/rfm69) examples first. Make sure to adjust the essential settings to match your hardware. Once those are working you can start customizing. The commands are documented through the example sketches. These functions are using basic C++ pointers for the data buffers passed into them.
I get the same results with the unaltered Gateway and Node sketches. I have three Moteinos and all three operate the same way.
The if statement always returns false.
Looking at the RFM69::sendWithRetry in the cpp program, the function returns true only if it receives an acknowledgement back from the receiver during the retry wait time.
So, if the if statement in the sketch is going to the else branch, it may have transmitted just fine, but never received an acknowledgement back.
Am I understanding this correctly?
You are correct, although those examples should work. You can always increase the ACK time but that should not have to be more than 20-30ms. I am first and foremost concerned with getting the examples to work, so you can start building your stuff on working example code.
I finally got back to this and was able to get this working -- sort-of.
I think the original problem is that I did not have the antennas attached to the Moteinos. I soldered antennas onto all three Moteinos, and they now send and receive ACKs properly.
However, this gets more and more unreliable as the distance between the node and host increases. When the distance is less than 20 feet, the ACKs are almost always received. At 50 feet, ACKs are received about 50% of the time. If I go over 100 yards away, almost no ACKs are received.
Has anyone else experienced this? Are there settings I should be tweaking? All my Moteinos are RFM69HW and the high power setting is on.