I am trying to learn C or C++, and I still have a problems as well as need a lot of help.
I am trying to adapt the GSM_Shield program to control a GSM module only to send and receive SMS, at the moment I am testing only the send command. I have to write another function to receive the response.
I have the following function call the I am testing:
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(power_pin, HIGH); // Switch ON the GSM module
delay(2000):
char SendATCmdWaitResp("AT+CREG?", 1000, "\r\n+CREG:1,1\r\n\r\nOK\r\n");
}
char SendATCmdWaitResp(char const *AT_cmd_string, uint16_t time_out,
char const *response_string)
{
byte status;
char ret_val = 0;
byte i;
Serial.println(AT_cmd_string);
/*
if(IsStringReceived(response_string)) {
ret_val = AT_RESP_OK;
break; // response is OK => finish
}
else ret_val = AT_RESP_ERR_DIF_RESP;
}
else {
// nothing was received
// --------------------
ret_val = AT_RESP_ERR_NO_RESP;
}
}
*/
return (ret_val);
I have the following errors:
GSM_Control_Final.ino: In function void loop();
GSM_Control_Final:48: error: expression list treated as a compound expression in initializer[-fpermissivel]
GSM_Control_Final:48: error: invalid conversion from 'cost char to char' [-fpermissivel]
expression list treated as a compound expression in initializer[-fpermissivel]
Then you have a naked "char" there at the function call. It returns a char and you do nothing with it. you need to assign it to a variable or use it some other way.