Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <LoRa.h>
- void setup() {
- Serial.begin(9600);
- while (!Serial);
- Serial.println("LoRa Receiver");
- if (!LoRa.begin(915E6)) {
- Serial.println("Starting LoRa failed!");
- while (1);
- }
- }
- void loop() {
- // Try to parse packet
- int packetSize = LoRa.parsePacket();
- if (packetSize) {
- // Read packet
- String received = "";
- while (LoRa.available()) {
- received += (char)LoRa.read();
- }
- // Print received packet
- Serial.print("Received packet: ");
- Serial.println(received);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement