Closed fixajteknik closed 2 years ago
well Actually I found another way with your hardware selection method like this,
#include "LoRa_E32.h"
#include <HardwareSerial.h>
HardwareSerial mySerial(1);
LoRa_E32 e32(2,15,&mySerial, UART_BPS_RATE_9600);
struct Signal {
char type[15] = "ESP32 Selam";
byte temp[4];
} data;
#define M0 18
#define M1 19
#define TX 2
#define RX 15
void setup() {
pinMode(M0, OUTPUT);
pinMode(M1, OUTPUT);
digitalWrite(M0, LOW);
digitalWrite(M1, 0);
Serial.begin(9600);
mySerial.begin(9600, SERIAL_8N1, TX, RX);
delay(500);
e32.begin();
delay(500);
}
void loop() {
ResponseStatus rs = e32.sendFixedMessage(0, 1, 6, &data, sizeof(Signal));
Serial.println(rs.getResponseDescription());
delay(2000);
while (e32.available() > 1) {
// Gelen mesaj okunuyor
ResponseStructContainer rsc = e32.receiveMessage(sizeof(Signal));
struct Signal data = *(Signal*) rsc.data;
Serial.print("Yer: ");
Serial.println(data.type);
rsc.close();
}
}
İs this safe to use?
Hi @fixajteknik, yes, you can find more information about the constructor in this paragraph. https://www.mischianti.org/2019/10/21/lora-e32-device-for-arduino-esp32-or-esp8266-library-part-2/#Constructor
Bye Renzo
well, I am using HMI display and Lora in a same project. but only I can use RX2/TX2 hardware serial but also I need to use a serial for connecting HMI display do you have prefer any example?