@electrik Good point! I copied these defines from some post in this forum, but it matches the pinout from Adafruit
You got me thinking that maybe there is something wrong in the Adafruit documentation about the Feather M0 built-in RFM69... The image on top says pin 7 for the RFM interrupt ... I tried pin 7, no dice...
I have a Feather M0 Express where I hooked up a RFM69HCW breakout, and it works! Naturally I had to modify the defines for the pins.
Here is the code for the Feather M0 Express:
#define MY_DEBUG
#define MY_BAUD_RATE 9600
#define MY_DEBUG_VERBOSE_TRANSPORT_HAL
#define MY_RADIO_RFM69
#define MY_RFM69_NEW_DRIVER
#define MY_RFM69_FREQUENCY (RFM69_433MHZ)
#define MY_IS_RFM69HW
#define MY_RFM69_IRQ_PIN (12)
#define MY_RFM69_IRQ_NUM digitalPinToInterrupt(MY_RFM69_IRQ_PIN)
#define MY_RFM69_RST_PIN (5)
#define MY_RFM69_CS_PIN 10
#define MY_SIGNAL_REPORT_ENABLED
#define MY_NODE_ID 4
#include "MySensors.h"
#define VBATPIN A7
#define CHILD_ID_VOLTAGE 0
MyMessage msgVoltage( CHILD_ID_VOLTAGE, V_VOLTAGE );
// Sleep time between sensor updates (in milliseconds)
void setup() {
// put your setup code here, to run once:
Serial.print("Setup... ");
}
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("My M0 Express Sensor", "1.0");
// Present sensors as children to gateway
present(CHILD_ID_VOLTAGE, S_MULTIMETER, "Voltage");
}
void loop() {
float measuredvbat = analogRead(VBATPIN);
measuredvbat *= 2; // we divided by 2, so multiply back
measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage
measuredvbat /= 1024; // convert to voltage
send(msgVoltage.set(measuredvbat, 2));
#ifdef MY_DEBUG
Serial.print("VBat: " ); Serial.println(measuredvbat);
#endif
wait(30000);
}
And this is the debug output:
__ __ ____
| \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___
| |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
| | | | |_| |___| | __/ | | \__ \ _ | | \__ \
|_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/
|___/ 2.4.0-alpha
1942 MCO:BGN:INIT NODE,CP=RPNNS---,FQ=48,REL=1,VER=2.4.0-alpha
4576 TSM:INIT
5456 TSF:WUR:MS=0
5456 THA:INIT
5463 TSM:INIT:TSP OK
5463 TSM:INIT:STATID=4
7216 THA:SAD:ADDR=4
8977 TSF:SID:OK,ID=4
8977 TSM:FPAR
8977 THA:SND:MSG=0404FF020307FF
8985 THA:SND:MSG LEN=7,RES=1
8985 ?TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
9403 THA:DATA:AVAIL
9407 THA:RCV:MSG=0000040A2308FF00
9407 THA:RCV:MSG LEN=8
9407 TSF:MSG:READ,0-0-4,s=255,c=3,t=8,pt=1,l=1,sg=0:0
9408 TSF:MSG:FPAR OK,ID=0,D=1
10987 TSM:FPAR:OK
10987 TSM:ID
10987 TSM:ID:OK
10987 TSM:UPL
10987 THA:SND:MSG=0404000A2318FF01
11068 THA:SND:MSG LEN=8,RES=1
11069 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
11378 THA:DATA:AVAIL
11388 THA:RCV:MSG=0000040A2319FF01
11388 THA:RCV:MSG LEN=8
11389 TSF:MSG:READ,0-0-4,s=255,c=3,t=25,pt=1,l=1,sg=0:1
11389 TSF:MSG:PONG RECV,HP=1
11389 TSM:UPL:OK
11389 TSM:READY:ID=4,PAR=0,DIS=1
11390 THA:SND:MSG=04040012C30FFF0100
11519 THA:SND:MSG LEN=9,RES=1
11519 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
11793 THA:DATA:AVAIL
11808 THA:RCV:MSG=00000412C30FFF0100
11808 THA:RCV:MSG LEN=9
11808 TSF:MSG:READ,0-0-4,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
11808 THA:SND:MSG=0404005A0011FF322E342E302D616C706861
11941 THA:SND:MSG LEN=18,RES=1
11941 TSF:MSG:SEND,4-4-0-0,s=255,c=0,t=17,pt=0,l=11,sg=0,ft=0,st=OK:2.4.0-alpha
11941 THA:SND:MSG=0404000A2306FF00
12500 THA:SND:MSG LEN=8,RES=1
12501 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
14501 THA:SND:MSG=040400A2030BFF4D79204D3020457870726573732053656E736F72
14564 THA:SND:MSG LEN=27,RES=1
14564 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=11,pt=0,l=20,sg=0,ft=0,st=OK:My M0 Express Sensor
14564 THA:SND:MSG=0404001A030CFF312E30
15123 THA:SND:MSG LEN=10,RES=1
15123 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
15123 THA:SND:MSG=0404003A001E00566F6C74616765
15683 THA:SND:MSG LEN=14,RES=1
15683 TSF:MSG:SEND,4-4-0-0,s=0,c=0,t=30,pt=0,l=7,sg=0,ft=0,st=OK:Voltage
15684 MCO:REG:REQ
15684 THA:SND:MSG=0404000A231AFF02
16242 THA:SND:MSG LEN=8,RES=1
16242 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
16515 THA:DATA:AVAIL
16523 THA:RCV:MSG=0000040A231BFF01
16523 THA:RCV:MSG LEN=8
16523 TSF:MSG:READ,0-0-4,s=255,c=3,t=27,pt=1,l=1,sg=0:1
16523 MCO:PIM:NODE REG=1
16524 MCO:BGN:STP
And now the "non-working" code from the Feather M0 with built-in RFM69:
#define MY_DEBUG
#define MY_BAUD_RATE 9600
#define MY_DEBUG_VERBOSE_TRANSPORT_HAL
#define MY_RADIO_RFM69
#define MY_RFM69_NEW_DRIVER
#define MY_RFM69_FREQUENCY (RFM69_433MHZ)
#define MY_IS_RFM69HW
#define MY_RFM69_RST_PIN 4
#define MY_RFM69_IRQ_PIN 3
#define MY_RFM69_IRQ_NUM digitalPinToInterrupt(MY_RFM69_IRQ_PIN)
#define MY_RFM69_CS_PIN 8
#define MY_SIGNAL_REPORT_ENABLED
#define MY_TRANSPORT_WAIT_READY_MS 15000
#define MY_NODE_ID 14
#include "MySensors.h"
#define VBATPIN A7
#define CHILD_ID_VOLTAGE 0
MyMessage msgVoltage( CHILD_ID_VOLTAGE, V_VOLTAGE );
void setup() {
// put your setup code here, to run once:
Serial.print("Setup... ");
}
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("My M0 Sensor", "1.0");
// Present sensors as children to gateway
present(CHILD_ID_VOLTAGE, S_MULTIMETER, "Voltage");
}
void loop() {
float measuredvbat = analogRead(VBATPIN);
measuredvbat *= 2; // we divided by 2, so multiply back
measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage
measuredvbat /= 1024; // convert to voltage
send(msgVoltage.set(measuredvbat, 2));
#ifdef MY_DEBUG
Serial.print("VBat: " ); Serial.println(measuredvbat);
#endif
wait(60000);
}