I only start with Transmitter Code of outdoor module and im not really sure if it works.
#include <SPI.h>
#include <LoRa.h>
#include <dht.h>
#include <LowPower.h>
#define dataPin 8 // DHT22 data pin
dht DHT;
char thChar[32] = "";
String thString = "";
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Sender");
if (!LoRa.begin(433E6)) { // or 915E6, the MHz speed of yout module
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
int readData = DHT.read22(dataPin); // Reads the data from the sensor
int t = DHT.temperature; // Gets the values of the temperature
int h = DHT.humidity; // Gets the values of the humidity
thString = String(t) + String(h);
thString.toCharArray(thChar, 12);
LoRa.beginPacket();
LoRa.print(thChar);
LoRa.endPacket();
delay(50);
// Sleep for 2 minutes, 15*8 = 120s
for (int sleepCounter = 15; sleepCounter > 0; sleepCounter--)
{
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}
}
You need a receiver as well! Build both parts and come back if you can't get it working! Remember to post your code for both parts, your wiring, and a note of how you are powering the units.