[RF69] Added links to default config wiki page

This commit is contained in:
jgromes 2020-07-04 11:26:01 +02:00
parent 59c4a71fad
commit 1db4a47181
9 changed files with 105 additions and 133 deletions

View file

@ -9,6 +9,9 @@
- frequency deviation - frequency deviation
- sync word - sync word
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -20,24 +23,18 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf = RadioShield.ModuleA; //RF69 radio = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -52,12 +49,12 @@ void loop() {
// you can receive data as an Arduino String // you can receive data as an Arduino String
String str; String str;
int state = rf.receive(str); int state = radio.receive(str);
// you can also receive data as byte array // you can also receive data as byte array
/* /*
byte byteArr[8]; byte byteArr[8];
int state = rf.receive(byteArr, 8); int state = radio.receive(byteArr, 8);
*/ */
if (state == ERR_NONE) { if (state == ERR_NONE) {
@ -71,7 +68,7 @@ void loop() {
// print RSSI (Received Signal Strength Indicator) // print RSSI (Received Signal Strength Indicator)
// of the last received packet // of the last received packet
Serial.print(F("[RF69] RSSI:\t\t")); Serial.print(F("[RF69] RSSI:\t\t"));
Serial.print(rf.getRSSI()); Serial.print(radio.getRSSI());
Serial.println(F(" dBm")); Serial.println(F(" dBm"));
} else if (state == ERR_RX_TIMEOUT) { } else if (state == ERR_RX_TIMEOUT) {

View file

@ -5,6 +5,9 @@
Packets are decrypted using hardware AES. Packets are decrypted using hardware AES.
NOTE: When using address filtering, the address byte is NOT encrypted! NOTE: When using address filtering, the address byte is NOT encrypted!
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -16,24 +19,18 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf = RadioShield.ModuleA; //RF69 radio = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -46,14 +43,14 @@ void setup() {
// NOTE: the key must be exactly 16 bytes long! // NOTE: the key must be exactly 16 bytes long!
uint8_t key[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, uint8_t key[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
rf.setAESKey(key); radio.setAESKey(key);
// enable AES encryption // enable AES encryption
rf.enableAES(); radio.enableAES();
// AES encryption can also be disabled // AES encryption can also be disabled
/* /*
rf.disableAES(); radio.disableAES();
*/ */
} }
@ -62,12 +59,12 @@ void loop() {
// you can receive data as an Arduino String // you can receive data as an Arduino String
String str; String str;
int state = rf.receive(str); int state = radio.receive(str);
// you can also receive data as byte array // you can also receive data as byte array
/* /*
byte byteArr[8]; byte byteArr[8];
int state = rf.receive(byteArr, 8); int state = radio.receive(byteArr, 8);
*/ */
if (state == ERR_NONE) { if (state == ERR_NONE) {

View file

@ -7,6 +7,9 @@
automatically filter out any packets that do not contain automatically filter out any packets that do not contain
either node address or broadcast address. either node address or broadcast address.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -18,24 +21,18 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf = RadioShield.ModuleA; //RF69 radio = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -48,7 +45,7 @@ void setup() {
// NOTE: calling this method will automatically enable // NOTE: calling this method will automatically enable
// address filtering (node address only) // address filtering (node address only)
Serial.print(F("[RF69] Setting node address ... ")); Serial.print(F("[RF69] Setting node address ... "));
state = rf.setNodeAddress(0x02); state = radio.setNodeAddress(0x02);
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -61,7 +58,7 @@ void setup() {
// NOTE: calling this method will automatically enable // NOTE: calling this method will automatically enable
// address filtering (node or broadcast address) // address filtering (node or broadcast address)
Serial.print(F("[RF69] Setting broadcast address ... ")); Serial.print(F("[RF69] Setting broadcast address ... "));
state = rf.setBroadcastAddress(0xFF); state = radio.setBroadcastAddress(0xFF);
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -75,7 +72,7 @@ void setup() {
// node and broadcast address // node and broadcast address
/* /*
Serial.print(F("[RF69] Disabling address filtering ... ")); Serial.print(F("[RF69] Disabling address filtering ... "));
state == rf.disableAddressFiltering(); state == radio.disableAddressFiltering();
if(state == ERR_NONE) { if(state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -91,12 +88,12 @@ void loop() {
// you can receive data as an Arduino String // you can receive data as an Arduino String
String str; String str;
int state = rf.receive(str); int state = radio.receive(str);
// you can also receive data as byte array // you can also receive data as byte array
/* /*
byte byteArr[8]; byte byteArr[8];
int state = rf.receive(byteArr, 8); int state = radio.receive(byteArr, 8);
*/ */
if (state == ERR_NONE) { if (state == ERR_NONE) {

View file

@ -5,6 +5,9 @@
receive them. Once a packet is received, an interrupt is receive them. Once a packet is received, an interrupt is
triggered. triggered.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -16,24 +19,18 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf = RadioShield.ModuleA; //RF69 radio = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -44,11 +41,11 @@ void setup() {
// set the function that will be called // set the function that will be called
// when new packet is received // when new packet is received
rf.setDio0Action(setFlag); radio.setDio0Action(setFlag);
// start listening for packets // start listening for packets
Serial.print(F("[RF69] Starting to listen ... ")); Serial.print(F("[RF69] Starting to listen ... "));
state = rf.startReceive(); state = radio.startReceive();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -60,11 +57,11 @@ void setup() {
// if needed, 'listen' mode can be disabled by calling // if needed, 'listen' mode can be disabled by calling
// any of the following methods: // any of the following methods:
// //
// rf.standby() // radio.standby()
// rf.sleep() // radio.sleep()
// rf.transmit(); // radio.transmit();
// rf.receive(); // radio.receive();
// rf.readData(); // radio.readData();
} }
// flag to indicate that a packet was received // flag to indicate that a packet was received
@ -99,12 +96,12 @@ void loop() {
// you can read received data as an Arduino String // you can read received data as an Arduino String
String str; String str;
int state = rf.readData(str); int state = radio.readData(str);
// you can also read received data as byte array // you can also read received data as byte array
/* /*
byte byteArr[8]; byte byteArr[8];
int state = rf.readData(byteArr, 8); int state = radio.readData(byteArr, 8);
*/ */
if (state == ERR_NONE) { if (state == ERR_NONE) {
@ -118,7 +115,7 @@ void loop() {
// print RSSI (Received Signal Strength Indicator) // print RSSI (Received Signal Strength Indicator)
// of the last received packet // of the last received packet
Serial.print(F("[RF69] RSSI:\t\t")); Serial.print(F("[RF69] RSSI:\t\t"));
Serial.print(rf.getRSSI()); Serial.print(radio.getRSSI());
Serial.println(F(" dBm")); Serial.println(F(" dBm"));
} else if (state == ERR_CRC_MISMATCH) { } else if (state == ERR_CRC_MISMATCH) {
@ -133,7 +130,7 @@ void loop() {
} }
// put module back to listen mode // put module back to listen mode
rf.startReceive(); radio.startReceive();
// we're ready to receive more packets, // we're ready to receive more packets,
// enable interrupt service routine // enable interrupt service routine

View file

@ -11,6 +11,9 @@
- output power during transmission - output power during transmission
- sync word - sync word
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -22,30 +25,24 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf1 = new Module(10, 2, 3); RF69 radio1 = new Module(10, 2, 3);
// second CC1101 has different connections: // second CC1101 has different connections:
// CS pin: 9 // CS pin: 9
// DIO0 pin: 4 // DIO0 pin: 4
// RESET pin: 5 // RESET pin: 5
RF69 rf2 = new Module(9, 4, 5); RF69 radio2 = new Module(9, 4, 5);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf3 = RadioShield.ModuleB; //RF69 radio3 = RadioShield.ModuleB;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio1.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf1.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -61,8 +58,7 @@ void setup() {
// frequency deviation: 60.0 kHz // frequency deviation: 60.0 kHz
// Rx bandwidth: 250.0 kHz // Rx bandwidth: 250.0 kHz
// output power: 17 dBm // output power: 17 dBm
// sync word: 0x2D01 state = radio2.begin(868.0, 300.0, 60.0, 250.0, 17);
state = rf2.begin(868.0, 300.0, 60.0, 250.0, 17);
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -75,13 +71,13 @@ void setup() {
// and check if the configuration was changed successfully // and check if the configuration was changed successfully
// set carrier frequency to 433.5 MHz // set carrier frequency to 433.5 MHz
if (rf1.setFrequency(433.5) == ERR_INVALID_FREQUENCY) { if (radio1.setFrequency(433.5) == ERR_INVALID_FREQUENCY) {
Serial.println(F("[RF69] Selected frequency is invalid for this module!")); Serial.println(F("[RF69] Selected frequency is invalid for this module!"));
while (true); while (true);
} }
// set bit rate to 100.0 kbps // set bit rate to 100.0 kbps
state = rf1.setBitRate(100.0); state = radio1.setBitRate(100.0);
if (state == ERR_INVALID_BIT_RATE) { if (state == ERR_INVALID_BIT_RATE) {
Serial.println(F("[RF69] Selected bit rate is invalid for this module!")); Serial.println(F("[RF69] Selected bit rate is invalid for this module!"));
while (true); while (true);
@ -92,7 +88,7 @@ void setup() {
} }
// set receiver bandwidth to 250.0 kHz // set receiver bandwidth to 250.0 kHz
state = rf1.setRxBandwidth(250.0); state = radio1.setRxBandwidth(250.0);
if (state == ERR_INVALID_RX_BANDWIDTH) { if (state == ERR_INVALID_RX_BANDWIDTH) {
Serial.println(F("[RF69] Selected receiver bandwidth is invalid for this module!")); Serial.println(F("[RF69] Selected receiver bandwidth is invalid for this module!"));
while (true); while (true);
@ -103,13 +99,13 @@ void setup() {
} }
// set allowed frequency deviation to 10.0 kHz // set allowed frequency deviation to 10.0 kHz
if (rf1.setFrequencyDeviation(10.0) == ERR_INVALID_FREQUENCY_DEVIATION) { if (radio1.setFrequencyDeviation(10.0) == ERR_INVALID_FREQUENCY_DEVIATION) {
Serial.println(F("[RF69] Selected frequency deviation is invalid for this module!")); Serial.println(F("[RF69] Selected frequency deviation is invalid for this module!"));
while (true); while (true);
} }
// set output power to 2 dBm // set output power to 2 dBm
if (rf1.setOutputPower(2) == ERR_INVALID_OUTPUT_POWER) { if (radio1.setOutputPower(2) == ERR_INVALID_OUTPUT_POWER) {
Serial.println(F("[RF69] Selected output power is invalid for this module!")); Serial.println(F("[RF69] Selected output power is invalid for this module!"));
while (true); while (true);
} }
@ -118,7 +114,7 @@ void setup() {
// NOTE: sync word must not contain any zero bytes // NOTE: sync word must not contain any zero bytes
// set sync word to 0x0123456789ABCDEF // set sync word to 0x0123456789ABCDEF
uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
if (rf1.setSyncWord(syncWord, 8) == ERR_INVALID_SYNC_WORD) { if (radio1.setSyncWord(syncWord, 8) == ERR_INVALID_SYNC_WORD) {
Serial.println(F("[RF69] Selected sync word is invalid for this module!")); Serial.println(F("[RF69] Selected sync word is invalid for this module!"));
while (true); while (true);
} }
@ -128,13 +124,13 @@ void setup() {
// RF69 can also measure temperature (roughly) // RF69 can also measure temperature (roughly)
// to get correct temperature measurements, the sensor must be calibrated // to get correct temperature measurements, the sensor must be calibrated
// at ambient temperature // at ambient temperature
rf1.setAmbientTemperature(25); // replace 25 with your ambient temperature radio1.setAmbientTemperature(25); // replace 25 with your ambient temperature
} }
void loop() { void loop() {
// measure temperature // measure temperature
Serial.print(F("[RF69] Measured temperature: ")); Serial.print(F("[RF69] Measured temperature: "));
Serial.print(rf1.getTemperature()); Serial.print(radio1.getTemperature());
Serial.println(F(" deg C")); Serial.println(F(" deg C"));
// wait 100 ms before the next measurement // wait 100 ms before the next measurement

View file

@ -7,6 +7,9 @@
- null-terminated char array (C-string) - null-terminated char array (C-string)
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -18,24 +21,18 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf = RadioShield.ModuleA; //RF69 radio = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -51,7 +48,7 @@ void setup() {
// second argument set to true. // second argument set to true.
/* /*
Serial.print(F("[RF69] Setting high power module ... ")); Serial.print(F("[RF69] Setting high power module ... "));
state = rf.setOutputPower(20, true); state = radio.setOutputPower(20, true);
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -66,12 +63,12 @@ void loop() {
Serial.print(F("[RF69] Transmitting packet ... ")); Serial.print(F("[RF69] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to 64 characters long // you can transmit C-string or Arduino string up to 64 characters long
int state = rf.transmit("Hello World!"); int state = radio.transmit("Hello World!");
// you can also transmit byte array up to 64 bytes long // you can also transmit byte array up to 64 bytes long
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
int state = rf.transmit(byteArr, 8); int state = radio.transmit(byteArr, 8);
*/ */
if (state == ERR_NONE) { if (state == ERR_NONE) {

View file

@ -5,6 +5,9 @@
Packets are encrypted using hardware AES. Packets are encrypted using hardware AES.
NOTE: When using address filtering, the address byte is NOT encrypted! NOTE: When using address filtering, the address byte is NOT encrypted!
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -16,24 +19,18 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf = RadioShield.ModuleA; //RF69 radio = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -46,14 +43,14 @@ void setup() {
// NOTE: the key must be exactly 16 bytes long! // NOTE: the key must be exactly 16 bytes long!
uint8_t key[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, uint8_t key[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
rf.setAESKey(key); radio.setAESKey(key);
// enable AES encryption // enable AES encryption
rf.enableAES(); radio.enableAES();
// AES encryption can also be disabled // AES encryption can also be disabled
/* /*
rf.disableAES(); radio.disableAES();
*/ */
} }
@ -61,12 +58,12 @@ void loop() {
Serial.print(F("[RF69] Transmitting packet ... ")); Serial.print(F("[RF69] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to 64 characters long // you can transmit C-string or Arduino string up to 64 characters long
int state = rf.transmit("Hello World!"); int state = radio.transmit("Hello World!");
// you can also transmit byte array up to 64 bytes long // you can also transmit byte array up to 64 bytes long
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
int state = rf.transmit(byteArr, 8); int state = radio.transmit(byteArr, 8);
*/ */
if (state == ERR_NONE) { if (state == ERR_NONE) {

View file

@ -7,6 +7,9 @@
automatically filter out any packets that do not contain automatically filter out any packets that do not contain
either node address or broadcast address. either node address or broadcast address.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -18,24 +21,18 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf = RadioShield.ModuleA; //RF69 radio = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -48,7 +45,7 @@ void setup() {
// NOTE: calling this method will automatically enable // NOTE: calling this method will automatically enable
// address filtering (node address only) // address filtering (node address only)
Serial.print(F("[RF69] Setting node address ... ")); Serial.print(F("[RF69] Setting node address ... "));
state = rf.setNodeAddress(0x01); state = radio.setNodeAddress(0x01);
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -61,7 +58,7 @@ void setup() {
// NOTE: calling this method will automatically enable // NOTE: calling this method will automatically enable
// address filtering (node or broadcast address) // address filtering (node or broadcast address)
Serial.print(F("[RF69] Setting broadcast address ... ")); Serial.print(F("[RF69] Setting broadcast address ... "));
state = rf.setBroadcastAddress(0xFF); state = radio.setBroadcastAddress(0xFF);
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -75,7 +72,7 @@ void setup() {
// node and broadcast address // node and broadcast address
/* /*
Serial.print(F("[RF69] Disabling address filtering ... ")); Serial.print(F("[RF69] Disabling address filtering ... "));
state = rf.disableAddressFiltering(); state = radio.disableAddressFiltering();
if(state == ERR_NONE) { if(state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {

View file

@ -8,6 +8,9 @@
- null-terminated char array (C-string) - null-terminated char array (C-string)
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
@ -19,11 +22,11 @@
// CS pin: 10 // CS pin: 10
// DIO0 pin: 2 // DIO0 pin: 2
// RESET pin: 3 // RESET pin: 3
RF69 rf = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or using RadioShield
// https://github.com/jgromes/RadioShield // https://github.com/jgromes/RadioShield
//RF69 rf = RadioShield.ModuleA; //RF69 radio = RadioShield.ModuleA;
// save transmission state between loops // save transmission state between loops
int transmissionState = ERR_NONE; int transmissionState = ERR_NONE;
@ -33,13 +36,7 @@ void setup() {
// initialize RF69 with default settings // initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... ")); Serial.print(F("[RF69] Initializing ... "));
// carrier frequency: 434.0 MHz int state = radio.begin();
// bit rate: 48.0 kbps
// frequency deviation: 50.0 kHz
// Rx bandwidth: 125.0 kHz
// output power: 13 dBm
// sync word: 0x2D01
int state = rf.begin();
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -50,7 +47,7 @@ void setup() {
// set the function that will be called // set the function that will be called
// when packet transmission is finished // when packet transmission is finished
rf.setDio0Action(setFlag); radio.setDio0Action(setFlag);
// NOTE: some RF69 modules use high power output, // NOTE: some RF69 modules use high power output,
// those are usually marked RF69H(C/CW). // those are usually marked RF69H(C/CW).
@ -59,7 +56,7 @@ void setup() {
// second argument set to true. // second argument set to true.
/* /*
Serial.print(F("[RF69] Setting high power module ... ")); Serial.print(F("[RF69] Setting high power module ... "));
state = rf.setOutputPower(20, true); state = radio.setOutputPower(20, true);
if (state == ERR_NONE) { if (state == ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
@ -74,13 +71,13 @@ void setup() {
// you can transmit C-string or Arduino string up to // you can transmit C-string or Arduino string up to
// 64 characters long // 64 characters long
transmissionState = rf.startTransmit("Hello World!"); transmissionState = radio.startTransmit("Hello World!");
// you can also transmit byte array up to 64 bytes long // you can also transmit byte array up to 64 bytes long
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF}; 0x89, 0xAB, 0xCD, 0xEF};
state = rf.startTransmit(byteArr, 8); state = radio.startTransmit(byteArr, 8);
*/ */
} }
@ -136,13 +133,13 @@ void loop() {
// you can transmit C-string or Arduino string up to // you can transmit C-string or Arduino string up to
// 256 characters long // 256 characters long
transmissionState = rf.startTransmit("Hello World!"); transmissionState = radio.startTransmit("Hello World!");
// you can also transmit byte array up to 64 bytes long // you can also transmit byte array up to 64 bytes long
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF}; 0x89, 0xAB, 0xCD, 0xEF};
int state = rf.startTransmit(byteArr, 8); int state = radio.startTransmit(byteArr, 8);
*/ */
// we're ready to send more packets, // we're ready to send more packets,