Hi
I need to generate a message in the required *Char Format so that I can send it by SMS
The message shall concatenate some text and some long data retrieved from the GPS device.
Unfortunately I am lost in String, Char *Char formats and their use.
The final Char message shall be sth like this :
"The coordinates of DC1234 are: Latitude=49.355N Longuitude=6.400E"
Please focus on: void GenerateSMS ()
String strFirstText = "The coordinates of " ; // this text is constant
String strCarID ; // This text is variable
String strSecondText = " are : Latitude= " ; // this text is constant
String strThirdText = "N Longuitude= " ; // this text is constant
String strForthText = "E" ; // this text is constant
long lonLatCoordinates ; // in the final code this data comes from a GPS device
long lonLongCoordinates ; // in the final code this data comes from a GPS device
String strSMSmessage ;
char chaSMSmessage ;
void setup()
{
Serial.begin (9600);
}
void loop()
{
strCarID = "DC1234";
ReadGPS ();
GenerateSMS () ;
SendSMS ();
}
void SendSMS ()
{
// Will be included in the final code and send the message in the required Char format.
}
void ReadGPS () // Will be included in the final code and retrieve the Coordinates from GPS in long
{
lonLatCoordinates = 49.355 ;
lonLongCoordinates = 6.400 ;
}
void GenerateSMS ()
{
strSMSmessage = strFirstText + strCarID + strSecondText + lonLatCoordinates + strThirdText + lonLongCoordinates + strForthText ;
chaSMSmessage = cha(strSMSmessage);
Serial.println (strSMSmessage) ;
Serial.println (chaSMSmessage) ;
}