I was checking the code and it does ot seems to difficult to to it. If you are interested I can publish a fork of OMG with XtoLORA functionnality, you may have to do some configuration and I would be interested by your test results.
yes please, do the fork, i will try because i tested a lot of sensors, tilt, bme280,dht,distance sensor, pir… etc and all works fine. This could be s great project if OMG supported more than 1 message Lora.
Code for vibration sensor
#include <SPI.h>
#include <LoRa.h>
#include <Wire.h>
#define SCK 5 // GPIO5 -- SX1278's SCK
#define MISO 19 // GPIO19 -- SX1278's MISnO
#define MOSI 27 // GPIO27 -- SX1278's MOSI
#define SS 18 // GPIO18 -- SX1278's CS
#define RST 14 // GPIO14 -- SX1278's RESET
#define DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)
#define BAND 433E6
const int reedPin = 4;
bool switchState = HIGH;
bool lastRead = false;
void setup() {
Serial.begin(115200);
//pinMode(reedPin, INPUT);
pinMode(reedPin, INPUT_PULLUP);
while (!Serial);
SPI.begin(SCK, MISO, MOSI, SS);
LoRa.setPins(SS, RST, DI0);
if (!LoRa.begin(433E6)) {
Serial.println("Starting //LoRa failed!");
while (1);
}
delay(1500);
lastRead = digitalRead(reedPin);
sendState(lastRead);
}
void loop() {
switchState = digitalRead(reedPin);
if (switchState != lastRead)
{
lastRead = switchState;
sendState(switchState);
}
delay(1000); //ajustavel
}
void sendState(bool state) {
Serial.print("Sending state: ");
Serial.println(state);
LoRa.beginPacket();
if (state)
LoRa.print("ON");
else
LoRa.print("OFF");
LoRa.endPacket();
}
Hi.
Is the fork available ?. I am very interested in being able to parse a payload with values from various sensors
Hi,
Not yet available
Will this work on OMG with RFM96W Lora also ?
Thanks
Denis