hwthinker icon

LORAUNO_Receiver-433MHz

hwthinker | PRO | 02/10/19 12:44:31 PM UTC | 0 ⭐ | 480 👁️ | Never ⏰ | []
Arduino |

1.17 KB

|

None

|

0 👍

/

0 👎

//modified lora library by Sandeep Mistry for Wemos TTGO LORA
// lora receiver modified by hwthinker
// setting board pro mini 5V
// serial port must open
 
#include <SPI.h>
#include <LoRa.h>
 
// GPIO5  -- SX1278's SCK
// GPIO19 -- SX1278's MISO
// GPIO27 -- SX1278's MOSI
// GPIO18 -- SX1278's CS
// GPIO14 -- SX1278's RESET
// GPIO26 -- SX1278's IRQ(Interrupt Request)
 
#define SS      10
#define RST     9
#define DI0     2
#define BAND    433E6  
 
void setup() {
  Serial.begin(115200);
  while (!Serial); //if just the the basic function, must connect to a computer
  delay(1000);
  
  Serial.println("LoRa Receiver");
  
//  SPI.begin(5,19,27,18);
  LoRa.setPins(SS,RST,DI0);
  
  if (!LoRa.begin(BAND)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}
 
void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
// received a packet
    Serial.print("Received packet '");
 
    // read packet
    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }
 
    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }
}

Comments