I'm having trouble with those few lines. I'm pasting the whole function because i saw that people love to understand the circumnstances of the errors before of giving an answer. Long story short : i'm having trouble with these 2 lines :
temp_string=bluetooth_Buffer.substring(9,13);
temp=atoi(temp_string);
temp_string is just a normal String variable and the arduino IDE come up to me with this error :
"exit status 1
cannot convert 'String' to 'const char*' for argument '1' to 'int atoi(const char*)' "
I honestly don't understand why because the .substring method should give me a string which should be used by atoi, soo as far as i know there shouldn't be problem with that. Soo that's why I'm here. Thank you for you time in advance.
void bluetooth_Parser()
{
if (int(bluetooth_Buffer.length())!=13) //Hard coded dimensions and particularities of the message
bluetooth_Buffer = "";
else if (bluetooth_Buffer[0]!='[')
bluetooth_Buffer = "";
else if (bluetooth_Buffer[3]!=',')
bluetooth_Buffer = "";
else if (bluetooth_Buffer[8]!=',')
bluetooth_Buffer = "";
else if (bluetooth_Buffer[13]!=']')
bluetooth_Buffer = "";
else
{ String temp_string, temp_string_debug;
long temp=0;
//Processing the activity figures
temp_string=bluetooth_Buffer.substring(1,3);
temp=atoi(temp_string);
function_temp.activity = int(temp) ;
//Processing the extra_value figures
temp_string=bluetooth_Buffer.substring(4,8);
temp=atoi(temp_string);
function_temp.extra_value = int(temp);
//Processing the extra_value2 figures
temp_string=bluetooth_Buffer.substring(9,13);
temp=atoi(temp_string);
function_temp.extra_value2 = int(temp);
activity_manager();
}
}