Hi All,
I am new to the arduino world and need some help on 2 issues on conversion between data types.
Issue 1. Char[] comparison with a "static string"
Issue 2. Convert float to Char[]
ISSUE-1
I have declared
char sms_text[6];
sms_text gets populated with the sms text when the gsm module receives. I want to compare a static string text say "sys" to the sms_text and then accordingly do something.
I have tried using the following
if (strcmp(sms_text,"sys"==0))
{
sms.SendSMS("+123456789", "status sms");
}
But this is not working. I believe either I am using the wrong function or there are some white space in the sms_text. However when i simply print it on serial monitor it displays 'sys'.
Can you please help me resolve this?
ISSUE 2-
I have float variable which needs to be sent out as sms.
Lets say it is
float val=345.67
The syntax of getSMS function is-
SendSMS(char *number_str, char *message_str)
I want to send the SMS and convert the float val into appropriate char* format as specified in the sendSMS function above so it goes through.
Any help is much appreciated!!
Cheers