How can i connect gps and lorawan in 1 esp32

Help me, I can't connect Neo-6m and MAXIIOT DL7612-AS923-TH in one Esp32-wroom-32. I want to get latitude/longtitude from neo-6m and send it to lorawan by maxiiot but i don't know to coding. This is code.

#include <TinyGPS++.h>
#include <HardwareSerial.h>

#define RXPin_1 (22)
#define TXPin_1 (21)

#define RXPin_2 (17)
#define TXPin_2 (16)

static const uint32_t GPSBaud = 9600;
String response = "";

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
HardwareSerial ss(2);

void setup(){
  Serial.begin(115200);
  ss.begin(GPSBaud, SERIAL_8N1, RXPin_1, TXPin_1, false);
  Serial.println(TinyGPSPlus::libraryVersion());
  Serial2.begin(115200, SERIAL_8N1, RXPin_2, TXPin_2);
  sendCommand("AT\r\n");
  sendCommand("AT+INFO\r\n");
  sendCommand("AT+NCONFIG\r\n");
  sendCommand("AT+DEVEUI\r\n");
  sendCommand("AT+APPKEY\r\n");
  sendCommand("AT+APPEUI\r\n");
  sendCommand("AT+NRB\r\n");
  delay(40000);
}

void loop(){
  while (ss.available() > 0)
  if (gps.encode(ss.read())){
  displayInfo();
  sendCommand("AT+INFO\r\n");
  sendCommand("AT+CGATT\r\n"); 
  sendData(5,"HELLO"); 
  delay(10000);
  }
  if (millis() > 5000 && gps.charsProcessed() < 10){
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  }
}

void displayInfo(){
  Serial.print(F("Location: "));
  if (gps.location.isValid()){
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }else{
    Serial.print(F("INVALID"));
  }
  Serial.println();
}

void sendCommand(String atComm){
  response = "";
  Serial2.print(atComm);
  Serial.println("*******AT Command Sent");
  Serial.print(atComm);
  delay(300);
  while(Serial2.available()){
     char ch = Serial2.read();
     //delay(500);
     response += ch;
     }
  Serial.println(response);
}

void sendData(int type, String data){
  String command = (String)"AT+NCMGS=" + type + "," +data + (String)"\r\n";
  sendCommand(command);
}

Then, does this code work or not? Does it contain some attempt at working, or is it just an unmodified example sketch that does not perform the stated function?

Context please?

The code you posted is for some GPS unit, but which one? Does it work with your GPS?

If so, find some example code for the radio, and try that out.

No, it works just maxiiot. can you help me please.

Sorry, I don't know what a maxiiot is.

i use neo-6m gps module, but it doesn't work. can you help me please.

Did you try some library example code with the GPS module?

maxiiot dl7612 is lorawan module.

I've tried connecting one module to one esp32, but it doesn't work when I connect both modules at the same time.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.