I am using arduino UNO connected with ultrasonic sensor and lora sx1278 as transmitter. At the receiver I have used ESP32 with another lora sx1278. I can receive the data in serial monitor but not in blynk
This is my receiver code esp32
#define BLYNK_TEMPLATE_ID "TMPL3JDF0IrHM"
#define BLYNK_TEMPLATE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "a7loU68cogNMZzv2SMupfLxDqkhDDY3Y"
#define BLYNK_PRINT Serial
//Incuding arduino default SPI library
#include <SPI.h>
//Incuding LoRa library
#include <LoRa.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
//define the pins used by the transceiver module
#define NSS 4
#define RST 5
#define DI0 2
char ssid[] = "abcdd";
char pass[] = "123456";
BlynkTimer timer;
String LoRaData;
void setup() {
//initialize Serial Monitor
Serial.begin(115200);
Serial.println("LoRa Receiver");
//setup LoRa transceiver module
LoRa.setPins(NSS, RST, DI0);
while (!LoRa.begin(433E6)) {
Serial.println(".");
delay(500);
}
// Change sync word (0xF1) to match the receiver LoRa
// This code ensure that you don't get LoRa messages
// from other LoRa transceivers
// ranges from 0-0xFF
LoRa.setSyncWord(0xF1);
Serial.println("LoRa Initializing Successful!");
Blynk.begin(BLYNK_AUTH_TOKEN , ssid, pass);
timer.setInterval(1000L, sendSensor);
}
void loop()
{
Blynk.run(); // run Blynk magic
timer.run(); // run timer every second
}
void sendSensor() {
// LoRa data packet size received from LoRa sender
int packetSize = LoRa.parsePacket();
// if the packer size is not 0, then execute this if condition
if (packetSize) {
// received a packet
Serial.print("Received packet: ");
// receiving the data from LoRa sender
while (LoRa.available()) {
LoRaData = LoRa.readString();
Blynk.virtualWrite(V0,LoRaData);
}
Serial.println(LoRaData);
}
//delay(500); // Adjust delay as needed
}