How to pass AT commands to Lora from ESP32 UART?
Posted: Mon May 29, 2023 7:50 pm
Hello, I have connected "Reyax RYLR998" Lora module to ESP32 UART2, but AT commands passed through Hardware serial not working.
I tried
Serial2.print((String)"AT+NETWORKID=5\n");
Serial2.println((String)"AT+NETWORKID=5\r");
Serial2.print((String)"AT+NETWORKID=5\r");
Nothing worked, no response from AT command,
Please help me I have been working on same problem for 2days.
Code: Select all
#define RXD2 16
#define TXD2 17
void setup()
{
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);
Serial.print("\nSetting Lora Module \n");
Serial2.print("AT+IPR=9600\r\n");
if (Serial2.available())
Serial.println(Serial2.read());
delay(1000);
Serial2.print("AT+BAND=865000000\r\n");
if (Serial2.available())
Serial.println(Serial2.read());
delay(1000);
Serial2.print("AT+ADDRESS=1\r\n");
if (Serial2.available()) S
erial.println(Serial2.read());
delay(1000);
Serial2.print((String)"AT+NETWORKID=5\r\n");
if (Serial2.available())
Serial.println(Serial2.read());
delay(1000);
}
void loop()
{
while (Serial2.available())
{
Serial.print(char(Serial2.read()));
}
}
Serial2.print((String)"AT+NETWORKID=5\n");
Serial2.println((String)"AT+NETWORKID=5\r");
Serial2.print((String)"AT+NETWORKID=5\r");
Nothing worked, no response from AT command,
Please help me I have been working on same problem for 2days.