[SX126x] Fixed typos in examples

This commit is contained in:
jgromes 2019-05-24 14:23:39 +02:00
parent 88d58e52d7
commit 0bafe185a9
5 changed files with 40 additions and 35 deletions

View file

@ -65,20 +65,20 @@ void loop() {
Serial.println(F("success!"));
// print the data of the packet
Serial.print("[SX1262] Data:\t\t");
Serial.print(F("[SX1262] Data:\t\t"));
Serial.println(str);
// print the RSSI (Received Signal Strength Indicator)
// of the last received packet
Serial.print("[SX1262] RSSI:\t\t");
Serial.print(F("[SX1262] RSSI:\t\t"));
Serial.print(lora.getRSSI());
Serial.println(" dBm");
Serial.println(F(" dBm"));
// print the SNR (Signal-to-Noise Ratio)
// of the last received packet
Serial.print("[SX1262] SNR:\t\t");
Serial.print(F("[SX1262] SNR:\t\t"));
Serial.print(lora.getSNR());
Serial.println(" dBm");
Serial.println(F(" dBm"));
} else if (state == ERR_RX_TIMEOUT) {
// timeout occurred while waiting for a packet

View file

@ -1,10 +1,10 @@
/*
RadioLib SX126x Receive with Inerrupts Example
RadioLib SX126x Receive with Interrupts Example
This example listens for LoRa transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered. To successfully receive data, the following
settings have to be the same on both transmitter
settings have to be the same on both transmitter
and receiver:
- carrier frequency
- bandwidth
@ -44,10 +44,10 @@ void setup() {
while (true);
}
// set the function that will be called
// set the function that will be called
// when new packet is received
lora.setDio1Action(setFlag);
// start listening for LoRa packets
Serial.print(F("[SX1262] Starting to listen ... "));
state = lora.startReceive();
@ -98,39 +98,39 @@ void loop() {
// reset flag
receivedFlag = false;
// you can read received data as an Arduino String
String str;
int state = lora.readData(str);
// you can also read received data as byte array
/*
byte byteArr[8];
int state = lora.receive(byteArr, 8);
*/
if (state == ERR_NONE) {
// packet was successfully received
Serial.println(F("[SX1262] Received packet!"));
// print data of the packet
Serial.print(F("[SX1262] Data:\t\t"));
Serial.println(str);
// print RSSI (Received Signal Strength Indicator)
// print RSSI (Received Signal Strength Indicator)
Serial.print(F("[SX1262] RSSI:\t\t"));
Serial.print(lora.getRSSI());
Serial.println(" dBm");
// print SNR (Signal-to-Noise Ratio)
Serial.println(F(" dBm"));
// print SNR (Signal-to-Noise Ratio)
Serial.print(F("[SX1262] SNR:\t\t"));
Serial.print(lora.getSNR());
Serial.println(F(" dBm"));
} else if (state == ERR_CRC_MISMATCH) {
// packet was received, but is malformed
Serial.println(F("CRC error!"));
}
// we're ready to receive more packets,

View file

@ -23,8 +23,13 @@
// SX1268 module is in slot A on the shield
SX1268 loraSX1268 = RadioShield.ModuleA;
// SX1262 module is in slot B on the shield
SX1262 loraSX1262 = RadioShield.ModuleB;
// if you're not using RadioShield, you can specify
// the connection yourself
// NSS pin: 6
// DIO1 pin: 4
// DIO2 pin: 5
// BUSY pin: 7
SX1262 loraSX1262 = new Module(6, 4, 5, 7);
void setup() {
Serial.begin(9600);
@ -51,7 +56,7 @@ void setup() {
// initialize the second LoRa instance with
// non-default settings
// this LoRa link will have high data rate,
// this LoRa link will have high data rate,
// but lower range
Serial.print(F("[SX1262] Initializing ... "));
// carrier frequency: 915.0 MHz
@ -130,14 +135,14 @@ void setup() {
while (true);
}
// Some SX126x have TCXO (temprature compensated crystal
// Some SX126x have TCXO (temperature compensated crystal
// oscillator). To configure TCXO reference voltage,
// the following method can be used.
if (loraSX1268.setTCXO(2.4) == ERR_INVALID_TCXO_VOLTAGE) {
Serial.println(F("Selected TCXO voltage is invalid for this module!"));
while (true);
}
Serial.println(F("All settings succesfully changed!"));
}

View file

@ -58,20 +58,20 @@ void loop() {
if (state == ERR_NONE) {
// the packet was successfully transmitted
Serial.println(" success!");
Serial.println(F(" success!"));
// print measured data rate
Serial.print("[SX1262] Datarate:\t");
Serial.print(F("[SX1262] Datarate:\t"));
Serial.print(lora.getDataRate());
Serial.println(" bps");
Serial.println(F(" bps"));
} else if (state == ERR_PACKET_TOO_LONG) {
// the supplied packet was longer than 256 bytes
Serial.println(" too long!");
Serial.println(F(" too long!"));
} else if (state == ERR_TX_TIMEOUT) {
// timeout occured while transmitting packet
Serial.println(" timeout!");
Serial.println(F(" timeout!"));
}

View file

@ -1,5 +1,5 @@
/*
RadioLib SX126x Transmit with Inerrupts Example
RadioLib SX126x Transmit with Interrupts Example
This example transmits LoRa packets with one second delays
between them. Each packet contains up to 256 bytes
@ -40,7 +40,7 @@ void setup() {
while (true);
}
// set the function that will be called
// set the function that will be called
// when packet transmission is finished
lora.setDio1Action(setFlag);
@ -57,7 +57,7 @@ void setup() {
0x78, 0xAB, 0xCD, 0xEF};
state = lora.transmit(byteArr, 8);
*/
if (state != ERR_NONE) {
Serial.print(F("failed, code "));
Serial.println(state);
@ -86,7 +86,7 @@ void loop() {
// you can transmit C-string or Arduino string up to
// 256 characters long
int state = lora.startTransmit("Hello World!");
// you can also transmit byte array up to 256 bytes long
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x56,
@ -97,7 +97,7 @@ void loop() {
// NOTE: when using interrupt-driven transmit method,
// it is not possible to automatically measure
// transmission data rate using getDataRate()
if (state != ERR_NONE) {
Serial.print(F("failed, code "));
Serial.println(state);