kopia lustrzana https://github.com/jgromes/RadioLib
[Si443x] Added links to default config wiki page
rodzic
1db4a47181
commit
d89025d8c7
|
@ -11,6 +11,9 @@
|
|||
|
||||
Other modules from Si443x/RFM2x family can also be used.
|
||||
|
||||
For default module settings, see the wiki page
|
||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#si443xrfm2x
|
||||
|
||||
For full API reference, see the GitHub Pages
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -22,24 +25,18 @@
|
|||
// nSEL pin: 10
|
||||
// nIRQ pin: 2
|
||||
// SDN pin: 9
|
||||
Si4432 fsk = new Module(10, 2, 9);
|
||||
Si4432 radio = new Module(10, 2, 9);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//Si4432 fsk = RadioShield.ModuleA;
|
||||
//Si4432 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize Si4432 with default settings
|
||||
Serial.print(F("[Si4432] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// bit rate: 48.0 kbps
|
||||
// frequency deviation: 50.0 kHz
|
||||
// Rx bandwidth: 225.1 kHz
|
||||
// output power: 11 dBm
|
||||
// sync word: 0x2D 0x01
|
||||
int state = fsk.begin();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -54,12 +51,12 @@ void loop() {
|
|||
|
||||
// you can receive data as an Arduino String
|
||||
String str;
|
||||
int state = fsk.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 @@
|
|||
|
||||
Other modules from Si443x/RFM2x family can also be used.
|
||||
|
||||
For default module settings, see the wiki page
|
||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#si443xrfm2x
|
||||
|
||||
For full API reference, see the GitHub Pages
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -18,24 +21,18 @@
|
|||
// nSEL pin: 10
|
||||
// nIRQ pin: 2
|
||||
// SDN pin: 9
|
||||
Si4432 fsk = new Module(10, 2, 9);
|
||||
Si4432 radio = new Module(10, 2, 9);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//Si4432 fsk = RadioShield.ModuleA;
|
||||
//Si4432 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize Si4432 with default settings
|
||||
Serial.print(F("[Si4432] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// bit rate: 48.0 kbps
|
||||
// frequency deviation: 50.0 kHz
|
||||
// Rx bandwidth: 225.1 kHz
|
||||
// output power: 11 dBm
|
||||
// sync word: 0x2D 0x01
|
||||
int state = fsk.begin();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -46,11 +43,11 @@ void setup() {
|
|||
|
||||
// set the function that will be called
|
||||
// when new packet is received
|
||||
fsk.setIrqAction(setFlag);
|
||||
radio.setIrqAction(setFlag);
|
||||
|
||||
// start listening for packets
|
||||
Serial.print(F("[Si4432] Starting to listen ... "));
|
||||
state = fsk.startReceive();
|
||||
state = radio.startReceive();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -62,11 +59,11 @@ void setup() {
|
|||
// if needed, 'listen' mode can be disabled by calling
|
||||
// any of the following methods:
|
||||
//
|
||||
// fsk.standby()
|
||||
// fsk.sleep()
|
||||
// fsk.transmit();
|
||||
// fsk.receive();
|
||||
// fsk.readData();
|
||||
// radio.standby()
|
||||
// radio.sleep()
|
||||
// radio.transmit();
|
||||
// radio.receive();
|
||||
// radio.readData();
|
||||
}
|
||||
|
||||
// flag to indicate that a packet was received
|
||||
|
@ -101,12 +98,12 @@ void loop() {
|
|||
|
||||
// you can read received data as an Arduino String
|
||||
String str;
|
||||
int state = fsk.readData(str);
|
||||
int state = radio.readData(str);
|
||||
|
||||
// you can also read received data as byte array
|
||||
/*
|
||||
byte byteArr[8];
|
||||
int state = fsk.readData(byteArr, 8);
|
||||
int state = radio.readData(byteArr, 8);
|
||||
*/
|
||||
|
||||
if (state == ERR_NONE) {
|
||||
|
@ -129,7 +126,7 @@ void loop() {
|
|||
}
|
||||
|
||||
// put module back to listen mode
|
||||
fsk.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#si443xrfm2x
|
||||
|
||||
For full API reference, see the GitHub Pages
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -22,30 +25,24 @@
|
|||
// nSEL pin: 10
|
||||
// nIRQ pin: 2
|
||||
// SDN pin: 9
|
||||
Si4432 fsk1 = new Module(10, 2, 9);
|
||||
Si4432 radio1 = new Module(10, 2, 9);
|
||||
|
||||
// Si4432 has the following connections:
|
||||
// nSEL pin: 8
|
||||
// nIRQ pin: 3
|
||||
// SDN pin: 7
|
||||
Si4432 fsk2 = new Module(8, 3, 7);
|
||||
Si4432 radio2 = new Module(8, 3, 7);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//Si4432 fsk3 = RadioShield.ModuleB;
|
||||
//Si4432 radio3 = RadioShield.ModuleB;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize Si4432 with default settings
|
||||
Serial.print(F("[Si4432] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// bit rate: 48.0 kbps
|
||||
// frequency deviation: 50.0 kHz
|
||||
// Rx bandwidth: 225.1 kHz
|
||||
// output power: 11 dBm
|
||||
// sync word: 0x2D 0x01
|
||||
int state = fsk1.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: 335.5 kHz
|
||||
// output power: 17 dBm
|
||||
// sync word: 0x2D 0x01
|
||||
state = fsk2.begin(868.0, 200.0, 60.0, 335.5, 17);
|
||||
state = radio2.begin(868.0, 200.0, 60.0, 335.5, 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 (fsk1.setFrequency(433.5) == ERR_INVALID_FREQUENCY) {
|
||||
if (radio1.setFrequency(433.5) == ERR_INVALID_FREQUENCY) {
|
||||
Serial.println(F("[Si4432] Selected frequency is invalid for this module!"));
|
||||
while (true);
|
||||
}
|
||||
|
||||
// set bit rate to 100.0 kbps
|
||||
state = fsk1.setBitRate(100.0);
|
||||
state = radio1.setBitRate(100.0);
|
||||
if (state == ERR_INVALID_BIT_RATE) {
|
||||
Serial.println(F("[Si4432] Selected bit rate is invalid for this module!"));
|
||||
while (true);
|
||||
|
@ -92,20 +88,20 @@ void setup() {
|
|||
}
|
||||
|
||||
// set receiver bandwidth to 284.8 kHz
|
||||
state = fsk1.setRxBandwidth(284.8);
|
||||
state = radio1.setRxBandwidth(284.8);
|
||||
if (state == ERR_INVALID_RX_BANDWIDTH) {
|
||||
Serial.println(F("[Si4432] Selected receiver bandwidth is invalid for this module!"));
|
||||
while (true);
|
||||
}
|
||||
|
||||
// set frequency deviation to 10.0 kHz
|
||||
if (fsk1.setFrequencyDeviation(10.0) == ERR_INVALID_FREQUENCY_DEVIATION) {
|
||||
if (radio1.setFrequencyDeviation(10.0) == ERR_INVALID_FREQUENCY_DEVIATION) {
|
||||
Serial.println(F("[Si4432] Selected frequency deviation is invalid for this module!"));
|
||||
while (true);
|
||||
}
|
||||
|
||||
// set output power to 2 dBm
|
||||
if (fsk1.setOutputPower(2) == ERR_INVALID_OUTPUT_POWER) {
|
||||
if (radio1.setOutputPower(2) == ERR_INVALID_OUTPUT_POWER) {
|
||||
Serial.println(F("[Si4432] Selected output power is invalid for this module!"));
|
||||
while (true);
|
||||
}
|
||||
|
@ -113,7 +109,7 @@ void setup() {
|
|||
// up to 4 bytes can be set as sync word
|
||||
// set sync word to 0x01234567
|
||||
uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67};
|
||||
if (fsk1.setSyncWord(syncWord, 4) == ERR_INVALID_SYNC_WORD) {
|
||||
if (radio1.setSyncWord(syncWord, 4) == ERR_INVALID_SYNC_WORD) {
|
||||
Serial.println(F("[Si4432] Selected sync word is invalid for this module!"));
|
||||
while (true);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
Other modules from Si443x/RFM2x family can also be used.
|
||||
|
||||
For default module settings, see the wiki page
|
||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#si443xrfm2x
|
||||
|
||||
For full API reference, see the GitHub Pages
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -20,24 +23,18 @@
|
|||
// nSEL pin: 10
|
||||
// nIRQ pin: 2
|
||||
// SDN pin: 9
|
||||
Si4432 fsk = new Module(10, 2, 9);
|
||||
Si4432 radio = new Module(10, 2, 9);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//Si4432 fsk = RadioShield.ModuleA;
|
||||
//Si4432 radio = RadioShield.ModuleA;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// initialize Si4432 with default settings
|
||||
Serial.print(F("[Si4432] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// bit rate: 48.0 kbps
|
||||
// frequency deviation: 50.0 kHz
|
||||
// Rx bandwidth: 225.1 kHz
|
||||
// output power: 11 dBm
|
||||
// sync word: 0x2D 0x01
|
||||
int state = fsk.begin();
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -55,12 +52,12 @@ void loop() {
|
|||
// NOTE: transmit() is a blocking method!
|
||||
// See example Si443x_Transmit_Interrupt for details
|
||||
// on non-blocking transmission method.
|
||||
int state = fsk.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, 0x56, 0x78, 0xAB, 0xCD, 0xEF};
|
||||
int state = fsk.transmit(byteArr, 8);
|
||||
int state = radio.transmit(byteArr, 8);
|
||||
*/
|
||||
|
||||
if (state == ERR_NONE) {
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
Other modules from Si443x/RFM2x family can also be used.
|
||||
|
||||
For default module settings, see the wiki page
|
||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#si443xrfm2x
|
||||
|
||||
For full API reference, see the GitHub Pages
|
||||
https://jgromes.github.io/RadioLib/
|
||||
*/
|
||||
|
@ -20,11 +23,11 @@
|
|||
// nSEL pin: 10
|
||||
// nIRQ pin: 2
|
||||
// SDN pin: 9
|
||||
Si4432 fsk = new Module(10, 2, 9);
|
||||
Si4432 radio = new Module(10, 2, 9);
|
||||
|
||||
// or using RadioShield
|
||||
// https://github.com/jgromes/RadioShield
|
||||
//Si4432 fsk = RadioShield.ModuleA;
|
||||
//Si4432 radio = RadioShield.ModuleA;
|
||||
|
||||
// save transmission state between loops
|
||||
int transmissionState = ERR_NONE;
|
||||
|
@ -34,14 +37,7 @@ void setup() {
|
|||
|
||||
// initialize Si4432 with default settings
|
||||
Serial.print(F("[Si4432] Initializing ... "));
|
||||
// carrier frequency: 434.0 MHz
|
||||
// bit rate: 48.0 kbps
|
||||
// frequency deviation: 50.0 kHz
|
||||
// Rx bandwidth: 225.1 kHz
|
||||
// output power: 11 dBm
|
||||
// sync word: 0x2D 0x01
|
||||
int state = fsk.begin();
|
||||
fsk.setOutputPower(13);
|
||||
int state = radio.begin();
|
||||
if (state == ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
|
@ -52,20 +48,20 @@ void setup() {
|
|||
|
||||
// set the function that will be called
|
||||
// when packet transmission is finished
|
||||
fsk.setIrqAction(setFlag);
|
||||
radio.setIrqAction(setFlag);
|
||||
|
||||
// start transmitting the first packet
|
||||
Serial.print(F("[Si4432] Sending first packet ... "));
|
||||
|
||||
// you can transmit C-string or Arduino string up to
|
||||
// 64 characters long
|
||||
transmissionState = fsk.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 = fsk.startTransmit(byteArr, 8);
|
||||
state = radio.startTransmit(byteArr, 8);
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -117,13 +113,13 @@ void loop() {
|
|||
|
||||
// you can transmit C-string or Arduino string up to
|
||||
// 256 characters long
|
||||
transmissionState = fsk.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 = fsk.startTransmit(byteArr, 8);
|
||||
int state = radio.startTransmit(byteArr, 8);
|
||||
*/
|
||||
|
||||
// we're ready to send more packets,
|
||||
|
|
Ładowanie…
Reference in New Issue