That is your problem. The file rfm.ino that you have says at the top: “Interface for the RFM69CW Radio Module” The RFM12B requires a completely different set of instructions.
The best I can offer is this library. It is ALMOST the same as the rfm.ini file that you have, but it adds the ability to control the radio power. There’s documentation (in English - sorry).
The rfm_init( );
function is the same, but the rfm_send( )
function adds the rf power. But you don’t need to specify it, it will default to maximum - which is what you have used until now.
So where you have (2 places)
rfm_send((byte *)&tmp, sizeof(tmp), networkGroup, nodeID, busyThreshold, busyTimeout);
you can reduce that to only
rfm_send((byte *)&tmp, sizeof(tmp), networkGroup, nodeID);
and rf_power, threshold & timeout will use the default values.
To use this in your sketch, you must delete (or move) rfm.ino, and install the library (2 files: rfmTxLib.h and rfmTxLib.cpp) into a directory rfmTxLib
in your Arduino libraries directory.
Then, in EmonTxV3CM.ino
, you must add
#define RFM12B
and after it
#include <rfmTxLib.h>
and you can delete these lines
#define RFM69CW
#define RFMSELPIN 10
#define RFMIRQPIN 2
#define RFPWR 0x99
If enum rfband {RF12_433MHZ = 1, RF12_868MHZ, RF12_915MHZ };
gives you an error, delete it. (It is already in the header file.)
and change “2” to “1” here:
int rf_whitening = 2;
And I think that will work.
rfmTxLib.zip (61.6 KB)