hi ,
I have arduino UNO , fastrexGPS UP501, WIFI esp8266 and web server HTML.
My project is Tracking system , by using these tools.
I wrote code , you can see code at the bottom
How I connect data from arduino UNO to Web server Html by this code :
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
SoftwareSerial esp8266(2, 3);
int countTrueCommand;
int countTimeCommand;
boolean found = false;
//name network
String ssid = "ssssssssss";
//password the networke
String password = "000000000";
//IP_Address thr server and port numper
/String IP_Address = "192.168.0....";
String Port = "2020";/
String dataGPS;
int RXPin = 5;
int TXPin = 6;
int GPSBoud=9600;
TinyGPSPlus gps;
SoftwareSerial gpsSerial(RXPin, TXPin);
void setup() {
Serial.begin(9600);
esp8266.begin(115200);
gpsSerial.begin(GPSBoud);
sendCommand("AT",5,"OK");
//sendCommand("AT+CWJAP=""+ ssid +"",""+ password +""",20,"OK");
sendCommand("AT+CWMODE=3",5,"OK");
sendCommand("AT+CIPMUX=1",5,"OK");
/* sendCommand("AT+CIPSTART=4,"UDP",""""+IP_Address+"","+Port,5,"OK");/
sendCommand("AT+CIPSEND=4,9",5,">");
Serial.println(dataGPS);
/
esp8266.println("AT\r");
delay(3000);
esp8266.println("AT+CWMODE=3\r");
delay(3000);
esp8266.println("AT+CIPMUX=1\r");
delay(3000);
esp8266.println( "AT+CIPSTART=4,"UDP","192.168.8.102",2020");
delay(3000);
esp8266.println("AT+CIPSEND=4,9\r");
*/
}
void loop() {
// This sketch displays information every time a new sentence is correctly encoded.
while (gpsSerial.available() > 0)
if (gps.encode(gpsSerial.read()))
displayInfo();
// If 5000 milliseconds pass and there are no characters coming in
// over the software serial port, show a "No GPS detected" error
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected"));
while(true);
}
if (esp8266.available()){ Serial.write(esp8266.read()); }
if ( Serial.available()){ esp8266.write(Serial.read()); }
}
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.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" "));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(":"));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F("INVALID"));
}
Serial.println();
}
void sendCommand(String command, int maxTime, char readReplay[]) {
Serial.print(countTrueCommand);
Serial.print(". at command => ");
Serial.print(command);
Serial.print(" ");
while(countTimeCommand < (maxTime*1))
{
esp8266.println(command);//at+cipsend
if(esp8266.find(readReplay))//ok
{
found = true;
break;
}
countTimeCommand++;
}
if(found == true)
{
Serial.println("OYI");
countTrueCommand++;
countTimeCommand = 0;
}
if(found == false)
{
Serial.println("Fail");
countTrueCommand = 0;
countTimeCommand = 0;
}
found = false;
}