I am using Arduino UNO with A9G board. I am not getting the "OK" response through the code. When i tried through USB to TTL converter, I am getting OK response.
Expected: "OK"
Getting: "No response from GPS module!"
#include <SoftwareSerial.h>
// Define software serial communication pins
const int gpsRxPin = 7;
const int gpsTxPin = 8;
// Create software serial object
SoftwareSerial gpsSerial(gpsRxPin, gpsTxPin);
void setup() {
// Initialize serial communication for debugging (optional)
Serial.begin(9600);
// Begin communication with GPS module at 9600 baud
gpsSerial.begin(9600);
delay(1000);
}
void loop() {
// Check for available data from GPS module
gpsSerial.println("AT");
delay(1000);
if (gpsSerial.available()) {
String response = gpsSerial.readStringUntil('\n');
Serial.println("Response: " + response);
if (response.indexOf("OK") != -1) {
Serial.println("AT command successful!");
} else {
Serial.println("AT command failed!");
}
} else {
Serial.println("No response from GPS module!");
}
delay(1000);
}