Closed j4zzcat closed 6 years ago
I'm successfully using two Lora32u4 II boards with the default send/receive examples. However, calling setSpreadingFactor with 9, 10, 11 or 12 hangs (haven't tried the other values).
#include <SPI.h> #include <LoRa.h> int counter = 0; void setup() { Serial.begin(115200); while (!Serial); Serial.println("LoRa Sender"); LoRa.setPins( 8, 4, 7 ); LoRa.setSpreadingFactor( 10 ); Serial.println( "After SPF" ); // <-- never gets here if (!LoRa.begin(915E6)) { Serial.println("Starting LoRa failed!"); while (1); } } void loop() { Serial.print("Sending packet: "); Serial.println(counter); // send packet LoRa.beginPacket(); LoRa.print("hello "); LoRa.print(counter); LoRa.endPacket(); counter++; delay(5000); }
You have to call LoRa.begin(YOUR_BAND) BEFORE calling LoRa.setSpreadingFactor( 10 );
Thanks.
I'm successfully using two Lora32u4 II boards with the default send/receive examples. However, calling setSpreadingFactor with 9, 10, 11 or 12 hangs (haven't tried the other values).