Error message "const char [78]' and 'float' to binary 'operator+'[/b]"

this is a code for my university project.after compiled it i have this error message

Arduino: 1.8.7 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\DCom\Desktop\trackhttp\newww\newww.ino: In function 'void sendDataToServer(int)':

newww:75:101: error: invalid operands of types 'const char [78]' and 'float' to binary 'operator+'

   mySerial.write("AT+HTTPPARA=\"URL\",\"smartbustrackingsystem1234.000webhostapp.com/neww.php?lat="+latitude+"&lon="+longitude+"\"");

                                                                                                     ^

Multiple libraries were found for "SoftwareSerial.h"
 Used: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial
 Not used: C:\Users\DCom\Documents\Arduino\libraries\SoftwareSerial
exit status 1
[b]invalid operands of types 'const char [78]' and 'float' to binary 'operator+'[/b]

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

[i]
this is my code.can you please help?[/i]

[/code]
#include <TinyGPS.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(9,10);
TinyGPS gps;
float latitude;
float longitude;
int DEVICEID = 0;
void gpsdump(TinyGPS &gps);
String printFloat(double f, int digits = 2);
void setup()
{
mySerial.begin(9600);
Serial.begin(9600);
pinMode(3, OUTPUT);
delay(10000);
setupHttpInit();
}
void loop ()
{
bool newdata = false;
unsigned long start = millis ();
while (millis() - start < 5000)
{
if (Serial.available())
{
char c = Serial.read();
//Serial.write(c);
//Serial.print(c);
if (gps.encode(c))
{
newdata = true;
break;
}
}
}

if (newdata)
{gpsdump(gps);
sendDataToServer(DEVICEID);
delay(500);
}
}
void waitUntilResponse(int delayMs)
{
while (mySerial.available() <0){ delay(delayMs);} while (mySerial.available() > 0)
{
Serial.write(mySerial.read());
}
}
void setupHttpInit() {
waitUntilResponse(500);
mySerial.println(“AT+SAPBR=3,1,“CONTYPE”,“GPRS””);
delay(1000);
waitUntilResponse(500);
mySerial.println(“AT+SAPBR=3,1,“APN”,“CMNET””);
delay(1000);
waitUntilResponse(500);
mySerial.println(“AT+SAPBR=1,1”);
delay(3000);
waitUntilResponse(500);
mySerial.println(“AT+HTTPINIT”);
delay(300);
waitUntilResponse(500);
}

void sendDataToServer(int deviceId)
{
mySerial.println(“AT+HTTPINIT”);
delay(300);
waitUntilResponse(500);
mySerial.println(“AT+HTTPPARA=“CID”,1\r\n”);
delay(300);
waitUntilResponse(500);
mySerial.write(“AT+HTTPPARA=“URL”,“smartbustrackingsystem1234.000webhostapp.com/neww.php?lat="+latitude+"&lon="+longitude+"””);
mySerial.print(deviceId);
mySerial.write("&lat=");
mySerial.print(latitude,9);
mySerial.write("&lon=");
mySerial.print(longitude,9);
mySerial.write(":80"\r\n");
delay(500);
waitUntilResponse(500);
mySerial.write(“AT+HTTPACTION=0”);
delay(3000);
waitUntilResponse(500);
mySerial.write(“AT+HTTPREAD=0”);
delay(500);
waitUntilResponse(500);
}
void gpsdump(TinyGPS &gps)
{ unsigned long age;
gps.f_get_position(&latitude,&longitude, &age);
}

[/code]

This corrections may help:

  • use mySerial.print instead of mySerial.write
  • Convert the both variables with String(latitude) to accepted parts of your long string.

The result should be:

mySerial.print("AT+HTTPPARA=\"URL\",\"smartbustrackingsystem1234.000webhostapp.com/neww.php?lat="+String(latitude)+"&lon="+String(longitude)+"\"");