I'm trying to send GPS data using esp8266 using Arduino board. I've used neo-6m receiver and esp8266-01 module. Below is my program using AT commands. The program is successfully compiled and loaded to the Arduino board, but the only output it gives on serial monitor is a simple begin. None of the AT commands are being executed. Not even the module connects to wi-fi. I can't point the error in my code. Please help me find the possible error. Thank you
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
TinyGPSPlus gps;
String ssid = "JioFi_244DB1D";
String password = "q52fq74c9s";
SoftwareSerial esp(6,7);
SoftwareSerial ss(8,9);
char Lat[12], Lon[12], alt[12],ch;
byte NOS;
byte l;
String webpage;
void reset(){
esp.println("AT+RST");
delay(1000);
if(esp.find("OK"))
Serial.println("Module Reset");
}
void ConnectWifi(){
esp.println("AT+CIPMUX=1");
esp.println("AT+CWMODE=1");
String cmd = "AT+CWJAP=\""+ssid+"\",\""+password+"\"";
esp.println(cmd);
delay(4000);
if(esp.find("OK"))
Serial.println("Connected!");
else {
ConnectWifi();
Serial.println("Connecting..");
}
}
void setup(){
esp.begin(9600);
Serial.begin(9600);
Serial.println("begin");
reset();
ConnectWifi();
esp.println("AT+CIFSR");
while(esp.available()>0){
if(esp.find("STAIP"))
{Serial.println("IP Address:");
while(esp.available()>0)
{ch=esp.read();
Serial.print(ch);}
}}}
void loop() {
ss.listen();
delay(2000);
while(ss.available()>0)
{
gps.encode(ss.read());
{
if(gps.location.isValid()){
// dtostrf(gps.location.lat(),1,6,Lat);
//dtostrf(gps.location.lng(),1,6,Lon);
webpage = "<!DOCTYPE html><html><body><form method = \"post\" action =\"http://localhost/php/esppost.php\"><label for = \"latitude\">Latitude:<\label><input type=number id = \"latitude\" name= \"latitude\" readonly value=";
// L = Lat.length();
l= webpage.length();
esp.println("AT+CIPSEND=0,");
esp.print(9+l+5);
esp.println(webpage);
esp.print(gps.location.lat(),6);
esp.print("\">");
delay(500);
webpage = "<Label for = \"Longitude\">Longitude:</Label><input type = \"number\" id = \"Longitude\" name = \"Longitude\" readonly value =\"";
l=webpage.length();
//L = Lon.length();
esp.println("AT+CIPSEND=0,");
esp.print(9+l+5);
esp.println(webpage);
esp.print(gps.location.lng(),6);
esp.print("\">");
}
else
webpage="Location Invalid";
l=webpage.length();
esp.println("AT+CIPSEND=0,");
esp.print(l+2);
esp.println(webpage);
delay(500);
if(gps.altitude.isValid()){
dtostrf(gps.altitude.meters(),1,6,alt);
webpage = "<label for=\"Altitude\">Altitude:<\label><input type = number id=\"Altitude\" name=\"Altitude\" readonly value=";
l=webpage.length();
//L= alt.length();
esp.println("AT+CIPSEND=0,");
esp.print(9+l+2);
esp.println(webpage);
esp.print(gps.altitude.meters(),6);
esp.print("\">");
}
if(gps.satellites.isValid()){
NOS= gps.satellites.value();
webpage= "<lable for = \"NOS \"> Number of Satellites:<\label><input type=number id=NOS name= NOS readonly value =";
l= webpage.length();
esp.println("AT+CIPSEND=0,");
esp.print(2+l+22);
esp.println(webpage);
esp.print(gps.satellites.value());
esp.print("></body></html>");
delay(500);
}}
esp.println("AT+CIPCLOSE");
}
}
esp
?