[RF69] Added links to default config wiki page
This commit is contained in:
parent
59c4a71fad
commit
1db4a47181
9 changed files with 105 additions and 133 deletions
examples/RF69
RF69_Receive
RF69_Receive_AES
RF69_Receive_Address
RF69_Receive_Interrupt
RF69_Settings
RF69_Transmit
RF69_Transmit_AES
RF69_Transmit_Address
RF69_Transmit_Interrupt
|
@ -9,6 +9,9 @@
|
|||
- frequency deviation
|
||||
- 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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -20,24 +23,18 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf = new Module(10, 2, 3);
|
||||
RF69 radio = new Module(10, 2, 3);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf = RadioShield.ModuleA;
|
||||
//RF69 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -52,12 +49,12 @@ void loop() {
|
|||
|
||||
// you can receive data as an Arduino String
|
||||
String str;
|
||||
int state = rf.receive(str);
|
||||
int state = radio.receive(str);
|
||||
|
||||
// you can also receive data as byte array
|
||||
/*
|
||||
byte byteArr[8];
|
||||
int state = rf.receive(byteArr, 8);
|
||||
int state = radio.receive(byteArr, 8);
|
||||
*/
|
||||
|
||||
if (state == ERR_NONE) {
|
||||
|
@ -71,7 +68,7 @@ void loop() {
|
|||
// print RSSI (Received Signal Strength Indicator)
|
||||
// of the last received packet
|
||||
Serial.print(F("[RF69] RSSI:\t\t"));
|
||||
Serial.print(rf.getRSSI());
|
||||
Serial.print(radio.getRSSI());
|
||||
Serial.println(F(" dBm"));
|
||||
|
||||
} else if (state == ERR_RX_TIMEOUT) {
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
Packets are decrypted using hardware AES.
|
||||
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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -16,24 +19,18 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf = new Module(10, 2, 3);
|
||||
RF69 radio = new Module(10, 2, 3);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf = RadioShield.ModuleA;
|
||||
//RF69 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -46,14 +43,14 @@ void setup() {
|
|||
// NOTE: the key must be exactly 16 bytes long!
|
||||
uint8_t key[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
|
||||
rf.setAESKey(key);
|
||||
radio.setAESKey(key);
|
||||
|
||||
// enable AES encryption
|
||||
rf.enableAES();
|
||||
radio.enableAES();
|
||||
|
||||
// AES encryption can also be disabled
|
||||
/*
|
||||
rf.disableAES();
|
||||
radio.disableAES();
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -62,12 +59,12 @@ void loop() {
|
|||
|
||||
// you can receive data as an Arduino String
|
||||
String str;
|
||||
int state = rf.receive(str);
|
||||
int state = radio.receive(str);
|
||||
|
||||
// you can also receive data as byte array
|
||||
/*
|
||||
byte byteArr[8];
|
||||
int state = rf.receive(byteArr, 8);
|
||||
int state = radio.receive(byteArr, 8);
|
||||
*/
|
||||
|
||||
if (state == ERR_NONE) {
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
automatically filter out any packets that do not contain
|
||||
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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -18,24 +21,18 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf = new Module(10, 2, 3);
|
||||
RF69 radio = new Module(10, 2, 3);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf = RadioShield.ModuleA;
|
||||
//RF69 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -48,7 +45,7 @@ void setup() {
|
|||
// NOTE: calling this method will automatically enable
|
||||
// address filtering (node address only)
|
||||
Serial.print(F("[RF69] Setting node address ... "));
|
||||
state = rf.setNodeAddress(0x02);
|
||||
state = radio.setNodeAddress(0x02);
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -61,7 +58,7 @@ void setup() {
|
|||
// NOTE: calling this method will automatically enable
|
||||
// address filtering (node or broadcast address)
|
||||
Serial.print(F("[RF69] Setting broadcast address ... "));
|
||||
state = rf.setBroadcastAddress(0xFF);
|
||||
state = radio.setBroadcastAddress(0xFF);
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -75,7 +72,7 @@ void setup() {
|
|||
// node and broadcast address
|
||||
/*
|
||||
Serial.print(F("[RF69] Disabling address filtering ... "));
|
||||
state == rf.disableAddressFiltering();
|
||||
state == radio.disableAddressFiltering();
|
||||
if(state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -91,12 +88,12 @@ void loop() {
|
|||
|
||||
// you can receive data as an Arduino String
|
||||
String str;
|
||||
int state = rf.receive(str);
|
||||
int state = radio.receive(str);
|
||||
|
||||
// you can also receive data as byte array
|
||||
/*
|
||||
byte byteArr[8];
|
||||
int state = rf.receive(byteArr, 8);
|
||||
int state = radio.receive(byteArr, 8);
|
||||
*/
|
||||
|
||||
if (state == ERR_NONE) {
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
receive them. Once a packet is received, an interrupt is
|
||||
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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -16,24 +19,18 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf = new Module(10, 2, 3);
|
||||
RF69 radio = new Module(10, 2, 3);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf = RadioShield.ModuleA;
|
||||
//RF69 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -44,11 +41,11 @@ void setup() {
|
|||
|
||||
// set the function that will be called
|
||||
// when new packet is received
|
||||
rf.setDio0Action(setFlag);
|
||||
radio.setDio0Action(setFlag);
|
||||
|
||||
// start listening for packets
|
||||
Serial.print(F("[RF69] Starting to listen ... "));
|
||||
state = rf.startReceive();
|
||||
state = radio.startReceive();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -60,11 +57,11 @@ void setup() {
|
|||
// if needed, 'listen' mode can be disabled by calling
|
||||
// any of the following methods:
|
||||
//
|
||||
// rf.standby()
|
||||
// rf.sleep()
|
||||
// rf.transmit();
|
||||
// rf.receive();
|
||||
// rf.readData();
|
||||
// radio.standby()
|
||||
// radio.sleep()
|
||||
// radio.transmit();
|
||||
// radio.receive();
|
||||
// radio.readData();
|
||||
}
|
||||
|
||||
// flag to indicate that a packet was received
|
||||
|
@ -99,12 +96,12 @@ void loop() {
|
|||
|
||||
// you can read received data as an Arduino String
|
||||
String str;
|
||||
int state = rf.readData(str);
|
||||
int state = radio.readData(str);
|
||||
|
||||
// you can also read received data as byte array
|
||||
/*
|
||||
byte byteArr[8];
|
||||
int state = rf.readData(byteArr, 8);
|
||||
int state = radio.readData(byteArr, 8);
|
||||
*/
|
||||
|
||||
if (state == ERR_NONE) {
|
||||
|
@ -118,7 +115,7 @@ void loop() {
|
|||
// print RSSI (Received Signal Strength Indicator)
|
||||
// of the last received packet
|
||||
Serial.print(F("[RF69] RSSI:\t\t"));
|
||||
Serial.print(rf.getRSSI());
|
||||
Serial.print(radio.getRSSI());
|
||||
Serial.println(F(" dBm"));
|
||||
|
||||
} else if (state == ERR_CRC_MISMATCH) {
|
||||
|
@ -133,7 +130,7 @@ void loop() {
|
|||
}
|
||||
|
||||
// put module back to listen mode
|
||||
rf.startReceive();
|
||||
radio.startReceive();
|
||||
|
||||
// we're ready to receive more packets,
|
||||
// enable interrupt service routine
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
- output power during transmission
|
||||
- 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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -22,30 +25,24 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf1 = new Module(10, 2, 3);
|
||||
RF69 radio1 = new Module(10, 2, 3);
|
||||
|
||||
// second CC1101 has different connections:
|
||||
// CS pin: 9
|
||||
// DIO0 pin: 4
|
||||
// RESET pin: 5
|
||||
RF69 rf2 = new Module(9, 4, 5);
|
||||
RF69 radio2 = new Module(9, 4, 5);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf3 = RadioShield.ModuleB;
|
||||
//RF69 radio3 = RadioShield.ModuleB;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio1.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -61,8 +58,7 @@ void setup() {
|
|||
// frequency deviation: 60.0 kHz
|
||||
// Rx bandwidth: 250.0 kHz
|
||||
// output power: 17 dBm
|
||||
// sync word: 0x2D01
|
||||
state = rf2.begin(868.0, 300.0, 60.0, 250.0, 17);
|
||||
state = radio2.begin(868.0, 300.0, 60.0, 250.0, 17);
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -75,13 +71,13 @@ void setup() {
|
|||
// and check if the configuration was changed successfully
|
||||
|
||||
// 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!"));
|
||||
while (true);
|
||||
}
|
||||
|
||||
// set bit rate to 100.0 kbps
|
||||
state = rf1.setBitRate(100.0);
|
||||
state = radio1.setBitRate(100.0);
|
||||
if (state == ERR_INVALID_BIT_RATE) {
|
||||
Serial.println(F("[RF69] Selected bit rate is invalid for this module!"));
|
||||
while (true);
|
||||
|
@ -92,7 +88,7 @@ void setup() {
|
|||
}
|
||||
|
||||
// set receiver bandwidth to 250.0 kHz
|
||||
state = rf1.setRxBandwidth(250.0);
|
||||
state = radio1.setRxBandwidth(250.0);
|
||||
if (state == ERR_INVALID_RX_BANDWIDTH) {
|
||||
Serial.println(F("[RF69] Selected receiver bandwidth is invalid for this module!"));
|
||||
while (true);
|
||||
|
@ -103,13 +99,13 @@ void setup() {
|
|||
}
|
||||
|
||||
// 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!"));
|
||||
while (true);
|
||||
}
|
||||
|
||||
// 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!"));
|
||||
while (true);
|
||||
}
|
||||
|
@ -118,7 +114,7 @@ void setup() {
|
|||
// NOTE: sync word must not contain any zero bytes
|
||||
// set sync word to 0x0123456789ABCDEF
|
||||
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!"));
|
||||
while (true);
|
||||
}
|
||||
|
@ -128,13 +124,13 @@ void setup() {
|
|||
// RF69 can also measure temperature (roughly)
|
||||
// to get correct temperature measurements, the sensor must be calibrated
|
||||
// at ambient temperature
|
||||
rf1.setAmbientTemperature(25); // replace 25 with your ambient temperature
|
||||
radio1.setAmbientTemperature(25); // replace 25 with your ambient temperature
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// measure temperature
|
||||
Serial.print(F("[RF69] Measured temperature: "));
|
||||
Serial.print(rf1.getTemperature());
|
||||
Serial.print(radio1.getTemperature());
|
||||
Serial.println(F(" deg C"));
|
||||
|
||||
// wait 100 ms before the next measurement
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
- null-terminated char array (C-string)
|
||||
- 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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -18,24 +21,18 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf = new Module(10, 2, 3);
|
||||
RF69 radio = new Module(10, 2, 3);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf = RadioShield.ModuleA;
|
||||
//RF69 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -51,7 +48,7 @@ void setup() {
|
|||
// second argument set to true.
|
||||
/*
|
||||
Serial.print(F("[RF69] Setting high power module ... "));
|
||||
state = rf.setOutputPower(20, true);
|
||||
state = radio.setOutputPower(20, true);
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -66,12 +63,12 @@ void loop() {
|
|||
Serial.print(F("[RF69] Transmitting packet ... "));
|
||||
|
||||
// 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
|
||||
/*
|
||||
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) {
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
Packets are encrypted using hardware AES.
|
||||
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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -16,24 +19,18 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf = new Module(10, 2, 3);
|
||||
RF69 radio = new Module(10, 2, 3);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf = RadioShield.ModuleA;
|
||||
//RF69 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -46,14 +43,14 @@ void setup() {
|
|||
// NOTE: the key must be exactly 16 bytes long!
|
||||
uint8_t key[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
|
||||
rf.setAESKey(key);
|
||||
radio.setAESKey(key);
|
||||
|
||||
// enable AES encryption
|
||||
rf.enableAES();
|
||||
radio.enableAES();
|
||||
|
||||
// AES encryption can also be disabled
|
||||
/*
|
||||
rf.disableAES();
|
||||
radio.disableAES();
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -61,12 +58,12 @@ void loop() {
|
|||
Serial.print(F("[RF69] Transmitting packet ... "));
|
||||
|
||||
// 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
|
||||
/*
|
||||
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) {
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
automatically filter out any packets that do not contain
|
||||
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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -18,24 +21,18 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf = new Module(10, 2, 3);
|
||||
RF69 radio = new Module(10, 2, 3);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf = RadioShield.ModuleA;
|
||||
//RF69 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -48,7 +45,7 @@ void setup() {
|
|||
// NOTE: calling this method will automatically enable
|
||||
// address filtering (node address only)
|
||||
Serial.print(F("[RF69] Setting node address ... "));
|
||||
state = rf.setNodeAddress(0x01);
|
||||
state = radio.setNodeAddress(0x01);
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -61,7 +58,7 @@ void setup() {
|
|||
// NOTE: calling this method will automatically enable
|
||||
// address filtering (node or broadcast address)
|
||||
Serial.print(F("[RF69] Setting broadcast address ... "));
|
||||
state = rf.setBroadcastAddress(0xFF);
|
||||
state = radio.setBroadcastAddress(0xFF);
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -75,7 +72,7 @@ void setup() {
|
|||
// node and broadcast address
|
||||
/*
|
||||
Serial.print(F("[RF69] Disabling address filtering ... "));
|
||||
state = rf.disableAddressFiltering();
|
||||
state = radio.disableAddressFiltering();
|
||||
if(state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
- null-terminated char array (C-string)
|
||||
- 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
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -19,11 +22,11 @@
|
|||
// CS pin: 10
|
||||
// DIO0 pin: 2
|
||||
// RESET pin: 3
|
||||
RF69 rf = new Module(10, 2, 3);
|
||||
RF69 radio = new Module(10, 2, 3);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//RF69 rf = RadioShield.ModuleA;
|
||||
//RF69 radio = RadioShield.ModuleA;
|
||||
|
||||
// save transmission state between loops
|
||||
int transmissionState = ERR_NONE;
|
||||
|
@ -33,13 +36,7 @@ void setup() {
|
|||
|
||||
// initialize RF69 with default settings
|
||||
Serial.print(F("[RF69] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// 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();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -50,7 +47,7 @@ void setup() {
|
|||
|
||||
// set the function that will be called
|
||||
// when packet transmission is finished
|
||||
rf.setDio0Action(setFlag);
|
||||
radio.setDio0Action(setFlag);
|
||||
|
||||
// NOTE: some RF69 modules use high power output,
|
||||
// those are usually marked RF69H(C/CW).
|
||||
|
@ -59,7 +56,7 @@ void setup() {
|
|||
// second argument set to true.
|
||||
/*
|
||||
Serial.print(F("[RF69] Setting high power module ... "));
|
||||
state = rf.setOutputPower(20, true);
|
||||
state = radio.setOutputPower(20, true);
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -74,13 +71,13 @@ void setup() {
|
|||
|
||||
// you can transmit C-string or Arduino string up to
|
||||
// 64 characters long
|
||||
transmissionState = rf.startTransmit("Hello World!");
|
||||
transmissionState = radio.startTransmit("Hello World!");
|
||||
|
||||
// you can also transmit byte array up to 64 bytes long
|
||||
/*
|
||||
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
||||
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
|
||||
// 256 characters long
|
||||
transmissionState = rf.startTransmit("Hello World!");
|
||||
transmissionState = radio.startTransmit("Hello World!");
|
||||
|
||||
// you can also transmit byte array up to 64 bytes long
|
||||
/*
|
||||
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
||||
0x89, 0xAB, 0xCD, 0xEF};
|
||||
int state = rf.startTransmit(byteArr, 8);
|
||||
int state = radio.startTransmit(byteArr, 8);
|
||||
*/
|
||||
|
||||
// we're ready to send more packets,
|
||||
|
|
Loading…
Add table
Reference in a new issue