Browse Source

add initial LoRa code

main
Hendrik Langer 7 years ago
parent
commit
cc360b019b
  1. 1
      platformio.ini
  2. 14
      src/main.cpp

1
platformio.ini

@ -33,4 +33,5 @@ lib_deps =
Adafruit BME280 Library
https://github.com/samguyer/FastLED.git
; https://github.com/h3ndrik/FastLED.git
LoRa
lib_ignore = ESPAsyncTCP

14
src/main.cpp

@ -26,7 +26,7 @@
#include <sys/time.h>
#include "apps/sntp/sntp.h"
//#include <LoRa.h>
#include <LoRa.h>
#include "driver/rtc_io.h"
@ -107,6 +107,18 @@ void setup() {
statusTopic = "esp32-node/stat/" + iot.hostname + "/status";
sensorTopic = "esp32-node/stat/" + iot.hostname + "/sensor";
// LoRa
SPI.begin(SX1276_SCK, SX1276_MISO, SX1276_MOSI, SX1276_CS);
LoRa.setPins(SX1276_CS, SX1276_RST, SX1276_IRQ);
if (!LoRa.begin(SX1276_BAND)) {
Serial.println("LoRa init failed");
} else {
//LoRa.onReceive(onLoRaReceive);
//LoRa.receive();
// LoRa.idle();
LoRa.sleep();
}
/*
//Use the web object to add elements to the interface
iot.web.addInterfaceElement("color", "input", "", "#configform", "LampColor");

Loading…
Cancel
Save