Advertisement
pleasedontcode

LoRaWAN Sender

Jul 30th, 2024
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 0.46 KB | Source Code | 0 0
  1. #include <SPI.h>
  2. #include <LoRa.h>
  3.  
  4. void setup() {
  5.   Serial.begin(9600);
  6.   while (!Serial);
  7.  
  8.   Serial.println("LoRa Sender");
  9.  
  10.   if (!LoRa.begin(915E6)) {
  11.     Serial.println("Starting LoRa failed!");
  12.     while (1);
  13.   }
  14. }
  15.  
  16. void loop() {
  17.   Serial.print("Sending packet: ");
  18.   Serial.println(counter);
  19.  
  20.   // Send packet
  21.   LoRa.beginPacket();
  22.   LoRa.print("Hello LoRa ");
  23.   LoRa.print(counter);
  24.   LoRa.endPacket();
  25.  
  26.   counter++;
  27.   delay(10000);
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement