I am trying to communicate between 2 esp32 (TTGO V2 epaper) using UART by LoRa. I am using this LoRa module : http://www.ebyte.com/en/product-view-ne ... ItNmko-Cxo
According to the circuit : https://ibb.co/xJkh8rS Rx and Tx use HS2
Here is the code of the emettor :
- HardwareSerial ss(2);
- uint8_t buff[16];
- int compt=0;
- int len=0,ret=0;;
- union
- {
- uint8_t buff[16];
- char tamp[16];
- } frame;
- void setup() {
- Serial.begin(9600);
- ss.begin(9600);
- }
- void loop() {
- compt++;
- sprintf(frame.tamp,"Packet:%d", compt);
- len=strlen(frame.tamp);
- Serial.println(len);Serial.println(frame.tamp);
- ret=ss.write(frame.buff,strlen(frame.tamp));
- Serial.println(ret);
- delay(3000);
- }
It shows that the emitter is working correctly.
And here is the code of the receiver :
Code: Select all
HardwareSerial ss(2);
char buff[16];
int i=0;
void setup() {
Serial.begin(9600);
Serial.println("begin");
ss.begin(9600);
}
void loop()
{
i=0;
//Serial.println(ss.available());
if(ss.available() > 1){//Read from UM402 and send to serial monitor
String input = ss.readString();
Serial.println(input);
}
delay(20);
}
Does someone have any idea of where it may come from ?