warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-string

#include //#include //#define MESSAGE_LENGTH 160 #define phone "01988621558" //char message[MESSAGE_LENGTH]; //int messageIndex = 0; char MESSAGE[300]; char lat[12]; char lon[12]; char wspeed[12];

//char datetime[24];

#define PIN_TX 10
#define PIN_RX 11
//SoftwareSerial mySerial(PIN_TX,PIN_RX);
//DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,

DFRobot_SIM808 sim808(&Serial);

void setup()
{
//mySerial.begin(9600);
Serial.begin(9600);

//******** Initialize sim808 module *************
while(!sim808.init())
{
Serial.print(“Sim808 init error\r\n”);
delay(1000);
}
delay(3000);

if( sim808.attachGPS())
Serial.println(“Open the GPS power success”);
else
Serial.println(“Open the GPS power failure”);

}

void loop()
{

while(!sim808.getGPS())
{

}

Serial.print(sim808.GPSdata.year);
Serial.print("/");
Serial.print(sim808.GPSdata.month);
Serial.print("/");
Serial.print(sim808.GPSdata.day);
Serial.print(" “);
Serial.print(sim808.GPSdata.hour);
Serial.print(”:");
Serial.print(sim808.GPSdata.minute);
Serial.print(":");
Serial.print(sim808.GPSdata.second);
Serial.print(":");
Serial.println(sim808.GPSdata.centisecond);
Serial.print(“latitude :”);
Serial.println(sim808.GPSdata.lat);
Serial.print(“longitude :”);
Serial.println(sim808.GPSdata.lon);
Serial.print(“speed_kph :”);
Serial.println(sim808.GPSdata.speed_kph);
Serial.print(“heading :”);
Serial.println(sim808.GPSdata.heading);
Serial.println();

float la = sim808.GPSdata.lat;
float lo = sim808.GPSdata.lon;
float ws = sim808.GPSdata.speed_kph;

dtostrf(la, 6, 2, lat); //put float value of la into char array of lat. 6 = number of digits before decimal sign. 2 = number of digits after the decimal sign.
dtostrf(lo, 6, 2, lon); //put float value of lo into char array of lon
dtostrf(ws, 6, 2, wspeed); //put float value of ws into char array of wspeed

sprintf(MESSAGE, “Latitude : %s\nLongitude : %s\nWind Speed : %s kph\nMy Module Is Working. Mewan Indula Pathirage. Try With This Link.\nhttp://www.latlong.net/Show-Latitude-Longitude.html\nhttp://maps.google.com/maps?q=%s,%s\n”, lat, lon, wspeed, lat, lon);

Serial.println(“Sim808 init success”);
Serial.println(“Start to send message …”);
Serial.println(MESSAGE);
Serial.println(phone);
//sim808.sendSMS(Phone,MESSAGE);

sim808.callUp(phone);
//************* Turn off the GPS power ************
sim808.detachGPS();

}

Hint: You’re not the first.

You should always use code tags when posting code

thank you. i'll do it from next time

To your question, where is the warning pointing at? You could either fix the library to add const where expected or put your string in a char buffer

rafez1558:
thank you. i'll do it from next time

hum.. why not do it now ? edit your first message and fix it...

-> add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)