where to put this code either on void loop or setup?? and I'm getting the error regarding function definition is not allowed here before '{' token.
String sendData(String command, const int timeout, boolean debug)
{
String response = "";
GSM8.print(command);
long int time = millis();
while ( (time + timeout) > millis())
{
while (GSM8.available())
{
char c = GSM8.read();
response += c;
wdt_reset();
}
wdt_reset();
}
if (debug)
{
Serial.println(response);
Serial.flush();
}
return response;
}