This commit is contained in:
2026-08-31 22:43:51 -04:00
commit c87308caca
521 changed files with 141326 additions and 0 deletions
+155
View File
@@ -0,0 +1,155 @@
// rf69 demo tx rx.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messaging client
// with the RH_RF69 class. RH_RF69 class does not provide for addressing
// or reliability, so you should only use RH_RF69 if you do not need the
// higher level messaging abilities.
// It is designed to work with the other example RadioHead69_RawDemo_TX.
// Demonstrates the use of AES encryption, setting the frequency and
// modem configuration.
#include <SPI.h>
#include <RH_RF69.h>
/************ Radio Setup ***************/
// Change to 434.0 or other frequency, must match RX's freq!
#define RF69_FREQ 434.0
// First 3 here are boards w/radio BUILT-IN. Boards using FeatherWing follow.
#if defined (__AVR_ATmega32U4__) // Feather 32u4 w/Radio
#define RFM69_CS 8
#define RFM69_INT 7
#define RFM69_RST 4
#define LED 13
#elif defined(ADAFRUIT_FEATHER_M0) || defined(ADAFRUIT_FEATHER_M0_EXPRESS) || defined(ARDUINO_SAMD_FEATHER_M0) // Feather M0 w/Radio
#define RFM69_CS 8
#define RFM69_INT 3
#define RFM69_RST 4
#define LED 13
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_RFM) // Feather RP2040 w/Radio
#define RFM69_CS 16
#define RFM69_INT 21
#define RFM69_RST 17
#define LED LED_BUILTIN
#elif defined (__AVR_ATmega328P__) // Feather 328P w/wing
#define RFM69_CS 4 //
#define RFM69_INT 3 //
#define RFM69_RST 2 // "A"
#define LED 13
#elif defined(ESP8266) // ESP8266 feather w/wing
#define RFM69_CS 2 // "E"
#define RFM69_INT 15 // "B"
#define RFM69_RST 16 // "D"
#define LED 0
#elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2) || defined(ARDUINO_NRF52840_FEATHER) || defined(ARDUINO_NRF52840_FEATHER_SENSE)
#define RFM69_CS 10 // "B"
#define RFM69_INT 9 // "A"
#define RFM69_RST 11 // "C"
#define LED 13
#elif defined(ESP32) // ESP32 feather w/wing
#define RFM69_CS 33 // "B"
#define RFM69_INT 27 // "A"
#define RFM69_RST 13 // same as LED
#define LED 13
#elif defined(ARDUINO_NRF52832_FEATHER) // nRF52832 feather w/wing
#define RFM69_CS 11 // "B"
#define RFM69_INT 31 // "C"
#define RFM69_RST 7 // "A"
#define LED 17
#endif
/* Teensy 3.x w/wing
#define RFM69_CS 10 // "B"
#define RFM69_INT 4 // "C"
#define RFM69_RST 9 // "A"
#define RFM69_IRQN digitalPinToInterrupt(RFM69_INT)
*/
/* WICED Feather w/wing
#define RFM69_CS PB4 // "B"
#define RFM69_INT PA15 // "C"
#define RFM69_RST PA4 // "A"
#define RFM69_IRQN RFM69_INT
*/
// Singleton instance of the radio driver
RH_RF69 rf69(RFM69_CS, RFM69_INT);
void setup() {
Serial.begin(115200);
while (!Serial) delay(1); // Wait for Serial Console (comment out line if no computer)
pinMode(LED, OUTPUT);
pinMode(RFM69_RST, OUTPUT);
digitalWrite(RFM69_RST, LOW);
Serial.println("Feather RFM69 RX Test!");
Serial.println();
// manual reset
digitalWrite(RFM69_RST, HIGH);
delay(10);
digitalWrite(RFM69_RST, LOW);
delay(10);
if (!rf69.init()) {
Serial.println("RFM69 radio init failed");
while (1);
}
Serial.println("RFM69 radio init OK!");
// Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM (for low power module)
// No encryption
if (!rf69.setFrequency(RF69_FREQ)) {
Serial.println("setFrequency failed");
}
// If you are using a high power RF69 eg RFM69HW, you *must* set a Tx power with the
// ishighpowermodule flag set like this:
rf69.setTxPower(20, true); // range from 14-20 for power, 2nd arg must be true for 69HCW
// The encryption key has to be the same as the one in the server
uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
// rf69.setEncryptionKey(key);
rf69.setEncryptionKey(NULL);
rf69.setPromiscuous(true);
Serial.print("RFM69 radio @"); Serial.print((int)RF69_FREQ); Serial.println(" MHz");
}
void loop() {}
void loop2() {
if (rf69.available()) {
// Should be a message for us now
uint8_t buf[RH_RF69_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf69.recv(buf, &len)) {
if (!len) return;
buf[len] = 0;
Serial.print("Received [");
Serial.print(len);
Serial.print("]: ");
Serial.println((char*)buf);
Serial.print("RSSI: ");
Serial.println(rf69.lastRssi(), DEC);
}
}
}
void Blink(byte pin, byte delay_ms, byte loops) {
while (loops--) {
digitalWrite(pin, HIGH);
delay(delay_ms);
digitalWrite(pin, LOW);
delay(delay_ms);
}
}
+203
View File
@@ -0,0 +1,203 @@
// rf69 demo tx rx.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messaging client
// with the RH_RF69 class. RH_RF69 class does not provide for addressing
// or reliability, so you should only use RH_RF69 if you do not need the
// higher level messaging abilities.
// It is designed to work with the other example RadioHead69_RawDemo_RX.
// Demonstrates the use of AES encryption, setting the frequency and
// modem configuration.
#include <SPI.h>
#include <RH_RF69.h>
/************ Radio Setup ***************/
// Change to 434.0 or other frequency, must match RX's freq!
#define RF69_FREQ 434.0
// First 3 here are boards w/radio BUILT-IN. Boards using FeatherWing follow.
#if defined (__AVR_ATmega32U4__) // Feather 32u4 w/Radio
#define RFM69_CS 8
#define RFM69_INT 7
#define RFM69_RST 4
#define LED 13
#elif defined(ADAFRUIT_FEATHER_M0) || defined(ADAFRUIT_FEATHER_M0_EXPRESS) || defined(ARDUINO_SAMD_FEATHER_M0) // Feather M0 w/Radio
#define RFM69_CS 8
#define RFM69_INT 3
#define RFM69_RST 4
#define LED 13
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_RFM) // Feather RP2040 w/Radio
#define RFM69_CS 16
#define RFM69_INT 21
#define RFM69_RST 17
#define LED LED_BUILTIN
#elif defined (__AVR_ATmega328P__) // Feather 328P w/wing
#define RFM69_CS 4 //
#define RFM69_INT 3 //
#define RFM69_RST 2 // "A"
#define LED 13
#elif defined(ESP8266) // ESP8266 feather w/wing
#define RFM69_CS 2 // "E"
#define RFM69_INT 15 // "B"
#define RFM69_RST 16 // "D"
#define LED 0
#elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2) || defined(ARDUINO_NRF52840_FEATHER) || defined(ARDUINO_NRF52840_FEATHER_SENSE)
#define RFM69_CS 10 // "B"
#define RFM69_INT 9 // "A"
#define RFM69_RST 11 // "C"
#define LED 13
#elif defined(ESP32) // ESP32 feather w/wing
#define RFM69_CS 33 // "B"
#define RFM69_INT 27 // "A"
#define RFM69_RST 13 // same as LED
#define LED 13
#elif defined(ARDUINO_NRF52832_FEATHER) // nRF52832 feather w/wing
#define RFM69_CS 11 // "B"
#define RFM69_INT 31 // "C"
#define RFM69_RST 7 // "A"
#define LED 17
#endif
/* Teensy 3.x w/wing
#define RFM69_CS 10 // "B"
#define RFM69_INT 4 // "C"
#define RFM69_RST 9 // "A"
#define RFM69_IRQN digitalPinToInterrupt(RFM69_INT)
*/
/* WICED Feather w/wing
#define RFM69_CS PB4 // "B"
#define RFM69_INT PA15 // "C"
#define RFM69_RST PA4 // "A"
#define RFM69_IRQN RFM69_INT
*/
// Singleton instance of the radio driver
RH_RF69 rf69(RFM69_CS, RFM69_INT);
int16_t packetnum = 0; // packet counter, we increment per xmission
void setup() {
Serial.begin(115200);
while (!Serial) delay(1); // Wait for Serial Console (comment out line if no computer)
pinMode(LED, OUTPUT);
pinMode(RFM69_RST, OUTPUT);
digitalWrite(RFM69_RST, LOW);
Serial.println("Feather RFM69 TX Test!");
Serial.println();
// manual reset
digitalWrite(RFM69_RST, HIGH);
delay(10);
digitalWrite(RFM69_RST, LOW);
delay(10);
if (!rf69.init()) {
Serial.println("RFM69 radio init failed");
while (1);
}
Serial.println("RFM69 radio init OK!");
// Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM (for low power module)
// No encryption
if (!rf69.setFrequency(RF69_FREQ)) {
Serial.println("setFrequency failed");
}
// If you are using a high power RF69 eg RFM69HW, you *must* set a Tx power with the
// ishighpowermodule flag set like this:
rf69.setTxPower(20, true); // range from 14-20 for power, 2nd arg must be true for 69HCW
// The encryption key has to be the same as the one in the server
uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
rf69.setEncryptionKey(NULL);
rf69.setPromiscuous(true);
Serial.print("RFM69 radio @"); Serial.print((int)RF69_FREQ); Serial.println(" MHz");
}
char HexLookUp[] = "0123456789abcdef";
void bytes2hex(unsigned char *src, char *out, int len) {
while (len--) {
*out++ = HexLookUp[*src >> 4];
*out++ = HexLookUp[*src & 0x0F];
src++;
}
*out = 0;
}
void loop2()
{
Serial.println("=============STARTING");
for (int i = 0; i<254; i++) {
unsigned char addr = i;
char vin = rf69.spiRead(addr);
char binary_string[9];
binary_string[8] = '\0'; // Null-terminate the string
for (int i = 0; i < 8; i++) {
binary_string[7 - i] = (vin & (1 << i)) ? '1' : '0';
}
Serial.print(" ");
Serial.print(binary_string);
Serial.print(" ");
char hex_buff[3];
bytes2hex(&addr, hex_buff, sizeof (addr));
Serial.print("0x");
Serial.println(hex_buff);
}
delay(2500);
}
void loopx() {
}
void loop() {
delay(1000); // Wait 1 second between transmits, could also 'sleep' here!
char radiopacket[20];
strncpy(radiopacket,"_",sizeof(radiopacket));
strncpy(radiopacket, "Hello World #", sizeof("Hello World #"));
// "Hello World #";
itoa(packetnum++, radiopacket+13, 10);
Serial.print("Sending "); Serial.println(radiopacket);
// Send a message!
rf69.send((uint8_t *)radiopacket, strlen(radiopacket));
rf69.waitPacketSent();
// Now wait for a reply
uint8_t buf[RH_RF69_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
}
void Blink(byte pin, byte delay_ms, byte loops) {
while (loops--) {
digitalWrite(pin, HIGH);
delay(delay_ms);
digitalWrite(pin, LOW);
delay(delay_ms);
}
}
+254
View File
@@ -0,0 +1,254 @@
00000000 0x00
00000100 0x01
00000001 0x02
00000000 0x03
10000000 0x04
00010000 0x05
00000000 0x06
01101100 0x07
10000000 0x08
00000000 0x09
01000001 0x0a
01000000 0x0b
00000010 0x0c
10010010 0x0d
11110101 0x0e
00100000 0x0f
00100100 0x10
01111111 0x11
00001001 0x12
00011010 0x13
01000000 0x14
10110000 0x15
01111011 0x16
10011011 0x17
00001000 0x18
11100000 0x19
11100000 0x1a
01000000 0x1b
10000000 0x1c
00000110 0x1d
00010000 0x1e
00000000 0x1f
00000000 0x20
00000000 0x21
00000000 0x22
00000010 0x23
11111111 0x24
00000000 0x25
00000101 0x26
10000000 0x27
00000000 0x28
11111111 0x29
00000000 0x2a
00000000 0x2b
00000000 0x2c
00000100 0x2d
10001000 0x2e
00101101 0x2f
11010100 0x30
00000000 0x31
00000000 0x32
00000000 0x33
00000000 0x34
00000000 0x35
00000000 0x36
11010000 0x37
01000000 0x38
00000000 0x39
00000000 0x3a
00000000 0x3b
10001111 0x3c
00000010 0x3d
00000000 0x3e
00000000 0x3f
00000000 0x40
00000000 0x41
00000000 0x42
00000000 0x43
00000000 0x44
00000000 0x45
00000000 0x46
00000000 0x47
00000000 0x48
00000000 0x49
00000000 0x4a
00000000 0x4b
00000000 0x4c
00000000 0x4d
00000001 0x4e
00000000 0x4f
00000000 0x50
00000001 0x51
10001000 0x52
00001000 0x53
00000000 0x54
00000000 0x55
00000001 0x56
00000000 0x57
00011011 0x58
00001001 0x59
01010101 0x5a
10000000 0x5b
01110000 0x5c
00110011 0x5d
11001010 0x5e
00001000 0x5f
00000000 0x60
00001111 0x61
00000000 0x62
00000000 0x63
00000000 0x64
00001111 0x65
01110000 0x66
00000000 0x67
00010001 0x68
00010101 0x69
00011000 0x6a
00011011 0x6b
00000000 0x6c
00000100 0x6d
00001100 0x6e
00110000 0x6f
00011000 0x70
00000000 0x71
00000000 0x72
00000000 0x73
00000000 0x74
00000000 0x75
00000000 0x76
00000000 0x77
00000000 0x78
00000000 0x79
00000000 0x7a
00000000 0x7b
00000000 0x7c
00000000 0x7d
00000000 0x7e
00000000 0x7f
00000000 0x80
00000100 0x81
00000001 0x82
00000000 0x83
10000000 0x84
00010000 0x85
00000000 0x86
01101100 0x87
10000000 0x88
00000000 0x89
01000001 0x8a
01000000 0x8b
00000010 0x8c
10010010 0x8d
11110101 0x8e
00100000 0x8f
00100100 0x90
01111111 0x91
00001001 0x92
00011010 0x93
01000000 0x94
10110000 0x95
01111011 0x96
10011011 0x97
00001000 0x98
11100000 0x99
11100000 0x9a
01000000 0x9b
10000000 0x9c
00000110 0x9d
00010000 0x9e
00000000 0x9f
00000000 0xa0
00000000 0xa1
00000000 0xa2
00000010 0xa3
11111111 0xa4
00000000 0xa5
00000101 0xa6
10000000 0xa7
00000000 0xa8
11111111 0xa9
00000000 0xaa
00000000 0xab
00000000 0xac
00000100 0xad
10001000 0xae
00101101 0xaf
11010100 0xb0
00000000 0xb1
00000000 0xb2
00000000 0xb3
00000000 0xb4
00000000 0xb5
00000000 0xb6
11010000 0xb7
01000000 0xb8
00000000 0xb9
00000000 0xba
00000000 0xbb
10001111 0xbc
00000010 0xbd
00000000 0xbe
00000000 0xbf
00000000 0xc0
00000000 0xc1
00000000 0xc2
00000000 0xc3
00000000 0xc4
00000000 0xc5
00000000 0xc6
00000000 0xc7
00000000 0xc8
00000000 0xc9
00000000 0xca
00000000 0xcb
00000000 0xcc
00000000 0xcd
00000001 0xce
00000000 0xcf
00000000 0xd0
00000001 0xd1
10001000 0xd2
00001000 0xd3
00000000 0xd4
00000000 0xd5
00000001 0xd6
00000000 0xd7
00011011 0xd8
00001001 0xd9
01010101 0xda
10000000 0xdb
01110000 0xdc
00110011 0xdd
11001010 0xde
00001000 0xdf
00000000 0xe0
00001111 0xe1
00000000 0xe2
00000000 0xe3
00000000 0xe4
00001111 0xe5
01110000 0xe6
00000000 0xe7
00010001 0xe8
00010101 0xe9
00011000 0xea
00011011 0xeb
00000000 0xec
00000100 0xed
00001100 0xee
00110000 0xef
00011000 0xf0
00000000 0xf1
00000000 0xf2
00000000 0xf3
00000000 0xf4
00000000 0xf5
00000000 0xf6
00000000 0xf7
00000000 0xf8
00000000 0xf9
00000000 0xfa
00000000 0xfb
00000000 0xfc
00000000 0xfd
@@ -0,0 +1,254 @@
00000000 0x00
00000100 0x01
00000001 0x02
00000000 0x03
10000000 0x04
00010000 0x05
00000000 0x06
01101100 0x07
10000000 0x08
00000000 0x09
01000001 0x0a
01000000 0x0b
00000010 0x0c
10010010 0x0d
11110101 0x0e
00100000 0x0f
00100100 0x10
01111111 0x11
00001001 0x12
00011010 0x13
01000000 0x14
10110000 0x15
01111011 0x16
10011011 0x17
00001000 0x18
11100000 0x19
11100000 0x1a
01000000 0x1b
10000000 0x1c
00000110 0x1d
00010000 0x1e
00000000 0x1f
00000000 0x20
00000000 0x21
00000000 0x22
00000010 0x23
11111111 0x24
00000000 0x25
00000101 0x26
10000000 0x27
00000000 0x28
11111111 0x29
00000000 0x2a
00000000 0x2b
00000000 0x2c
00000100 0x2d
10001000 0x2e
00101101 0x2f
11010100 0x30
00000000 0x31
00000000 0x32
00000000 0x33
00000000 0x34
00000000 0x35
00000000 0x36
11010000 0x37
01000000 0x38
00000000 0x39
00000000 0x3a
00000000 0x3b
10001111 0x3c
00000010 0x3d
00000000 0x3e
00000000 0x3f
00000000 0x40
00000000 0x41
00000000 0x42
00000000 0x43
00000000 0x44
00000000 0x45
00000000 0x46
00000000 0x47
00000000 0x48
00000000 0x49
00000000 0x4a
00000000 0x4b
00000000 0x4c
00000000 0x4d
00000001 0x4e
00000000 0x4f
00000000 0x50
00000001 0x51
10001000 0x52
00001000 0x53
00000000 0x54
00000000 0x55
00000001 0x56
00000000 0x57
00011011 0x58
00001001 0x59
01010101 0x5a
10000000 0x5b
01110000 0x5c
00110011 0x5d
11001010 0x5e
00001000 0x5f
00000000 0x60
00001111 0x61
00000000 0x62
00000000 0x63
00000000 0x64
00001111 0x65
01110000 0x66
00000000 0x67
00010001 0x68
00010101 0x69
00011000 0x6a
00011011 0x6b
00000000 0x6c
00000100 0x6d
00001100 0x6e
00110000 0x6f
00011000 0x70
00000000 0x71
00000000 0x72
00000000 0x73
00000000 0x74
00000000 0x75
00000000 0x76
00000000 0x77
00000000 0x78
00000000 0x79
00000000 0x7a
00000000 0x7b
00000000 0x7c
00000000 0x7d
00000000 0x7e
00000000 0x7f
00000000 0x80
00000100 0x81
00000001 0x82
00000000 0x83
10000000 0x84
00010000 0x85
00000000 0x86
01101100 0x87
10000000 0x88
00000000 0x89
01000001 0x8a
01000000 0x8b
00000010 0x8c
10010010 0x8d
11110101 0x8e
00100000 0x8f
00100100 0x90
01111111 0x91
00001001 0x92
00011010 0x93
01000000 0x94
10110000 0x95
01111011 0x96
10011011 0x97
00001000 0x98
11100000 0x99
11100000 0x9a
01000000 0x9b
10000000 0x9c
00000110 0x9d
00010000 0x9e
00000000 0x9f
00000000 0xa0
00000000 0xa1
00000000 0xa2
00000010 0xa3
11111111 0xa4
00000000 0xa5
00000101 0xa6
10000000 0xa7
00000000 0xa8
11111111 0xa9
00000000 0xaa
00000000 0xab
00000000 0xac
00000100 0xad
10001000 0xae
00101101 0xaf
11010100 0xb0
00000000 0xb1
00000000 0xb2
00000000 0xb3
00000000 0xb4
00000000 0xb5
00000000 0xb6
11010000 0xb7
01000000 0xb8
00000000 0xb9
00000000 0xba
00000000 0xbb
10001111 0xbc
00000010 0xbd
00000000 0xbe
00000000 0xbf
00000000 0xc0
00000000 0xc1
00000000 0xc2
00000000 0xc3
00000000 0xc4
00000000 0xc5
00000000 0xc6
00000000 0xc7
00000000 0xc8
00000000 0xc9
00000000 0xca
00000000 0xcb
00000000 0xcc
00000000 0xcd
00000001 0xce
00000000 0xcf
00000000 0xd0
00000001 0xd1
10001000 0xd2
00001000 0xd3
00000000 0xd4
00000000 0xd5
00000001 0xd6
00000000 0xd7
00011011 0xd8
00001001 0xd9
01010101 0xda
10000000 0xdb
01110000 0xdc
00110011 0xdd
11001010 0xde
00001000 0xdf
00000000 0xe0
00001111 0xe1
00000000 0xe2
00000000 0xe3
00000000 0xe4
00001111 0xe5
01110000 0xe6
00000000 0xe7
00010001 0xe8
00010101 0xe9
00011000 0xea
00011011 0xeb
00000000 0xec
00000100 0xed
00001100 0xee
00110000 0xef
00011000 0xf0
00000000 0xf1
00000000 0xf2
00000000 0xf3
00000000 0xf4
00000000 0xf5
00000000 0xf6
00000000 0xf7
00000000 0xf8
00000000 0xf9
00000000 0xfa
00000000 0xfb
00000000 0xfc
00000000 0xfd