Erro na Verificação

Galera alguém pode me ajudar, sou muito novato e estou tendo problemas com essa programação pois quando mando verificar na IDE ele me dá o seguinte erro:exit status 1
expected ‘}’ at end of input

Ai a baixo o Sketch todo:

#include <SoftwareSerial.h>
#include <espduino.h>
#include <rest.h>

SoftwareSerial espPort(10, 11);
ESP esp(&espPort, &Serial, 9);
REST rest(&esp);
boolean wifiConnected = false;

const int relay1 = 2;
const int relay2 = 3;
const int relay3 = 4;
const int relay4 = 5;

boolean data1 = false;
boolean data2 = false;
boolean data3 = false;
boolean data4 = false;
int loop_count = 0;

char response[266];
char buff[64];
String strId,strData,strCode;
String strData_Last1,strData_Last2,strData_Last3,strData_Last4;

void(* resetFunc) (void) = 0;

void clearBuffer(void) {
for (int i = 0;i<266;i++ ) {
response*=0;*

  • }*
    }
    void wifiCb(void* response)
    {

  • uint32_t status;*

  • RESPONSE res(response);*

  • if(res.getArgc() == 1) {*
    res.popArgs((uint8_t*)&status, 4);

  • if(status == STATION_GOT_IP) {*

  • Serial.println(“TERHUBUNG KE WIFI”);*

  • wifiConnected = true;*

  • } else {*

  • wifiConnected = false;*

  • }*

  • }*
    }
    void setup() {

  • pinMode(relay1, OUTPUT);*

  • pinMode(relay2, OUTPUT);*

  • pinMode(relay3, OUTPUT);*

  • pinMode(relay4, OUTPUT);*

  • digitalWrite(relay1,HIGH);*

  • digitalWrite(relay2,HIGH);*

  • digitalWrite(relay3,HIGH);*

  • digitalWrite(relay4,HIGH);*

  • Serial.begin(9600);*

  • espPort.begin(19200);*

  • esp.enable();*

  • delay(500);*

  • esp.reset();*

  • delay(500);*

  • while(!esp.ready());*

  • Serial.println(“ARDUINO: Setup client”);*

  • if(!rest.begin(“api.thingspeak.com”)) {*

  • Serial.println(“ARDUINO: Gagal Setup client”);*

  • while(1);*

  • }*

  • Serial.println(“ARDUINO: Menghubungkan dengan Wifi”);*

  • esp.wifiCb.attach(&wifiCb);*

  • esp.wifiConnect(“Andy182 Network”,“waipigratis”);*

  • Serial.println(“ARDUINO: System sudah siap!”);*
    }
    void loop() {
    loop_start:

  • esp.process();*

  • if(wifiConnected) { *

  • char str_field1[6] , str_field2[6] , str_field3[6] , str_field4[6];*

  • sprintf(buff, “/channels/58419/fields/1/last”);*

  • Serial.println(buff);*

_ rest.get((const char*)buff);_

  • if(rest.getResponse(response, 266) == HTTP_STATUS_OK){*

  • strId = “”;*

  • strData = “”;*

  • strCode = “”;*

  • getData(); *

  • if (strData == “1” || strData == “1.0” || strData == “1.00” ){*

  • digitalWrite(relay1,LOW);*

  • data1 = true;*

  • }*

  • if (strData == “0” || strData == “-1” || strData == “0.1” || strData == “0.10”){*

  • digitalWrite(relay1,HIGH);*

  • data1 = false;*

  • }*

  • }*

  • else{*

  • hardReset();*

  • resetFunc();*

  • }*

  • delay(10000);*

  • sprintf(buff, “/channels/58419/fields/2/last”);*

  • Serial.println(buff);*

_ rest.get((const char*)buff);_

  • if(rest.getResponse(response, 266) == HTTP_STATUS_OK){*

  • strId = “”; strData = “”; strCode = “”;*

  • getData();*

  • if (strData == “1” || strData == “1.0” || strData == “1.00”){*

  • digitalWrite(relay2,LOW);*

  • data2 = true; *

  • }*

  • if (strData == “0” || strData == “-1” || strData == “0.1” || strData == “0.10”){*

  • digitalWrite(relay2,HIGH);*

  • data2 = false; *

  • } *

  • }*

  • else{*

  • hardReset();*

  • resetFunc();*

  • clearBuffer();*

  • goto loop_start; *

  • } *

  • delay(10000);*

  • sprintf(buff, “/channels/58419/fields/3/last”);*

  • Serial.println(buff);*

_ rest.get((const char*)buff);_

  • if(rest.getResponse(response, 266) == HTTP_STATUS_OK){*

  • strId = “”; strData = “”; strCode = “”;*

  • getData(); // GET DATA*

  • if (strData == “1” || strData == “1.0” || strData == “1.00”){*

  • digitalWrite(relay3,LOW);*

  • data3 = true; *

  • }*

  • if (strData == “0” || strData == “-1” || strData == “0.1” || strData == “0.10”){*

  • digitalWrite(relay3,HIGH);*

  • data3 = false; *

  • } *

  • }*

  • else{*

  • hardReset();*

  • resetFunc();*

  • clearBuffer();*

  • goto loop_start; *

  • }*

  • delay(10000);*

  • sprintf(buff, “/channels/58419/fields/4/last”); // field x last Data*

  • Serial.println(buff);*

_ rest.get((const char*)buff);_

  • if(rest.getResponse(response, 266) == HTTP_STATUS_OK){*

  • strId = “”; strData = “”; strCode = “”;*

  • getData(); // GET DATA*

  • if (strData == “1” || strData == “1.0” || strData == “1.00”){*

  • digitalWrite(relay4,LOW);*

  • data4 = true; *

  • }*

  • if (strData == “0” || strData == “-1” || strData == “0.1” || strData == “0.10”){*

  • digitalWrite(relay4,HIGH);*

  • data4 = false; *

  • } *

  • }*

  • else{*

  • hardReset();*

  • resetFunc();*

  • clearBuffer();*

  • goto loop_start; *

  • }*

  • delay(10000); *

  • loop_count++;*

  • Serial.println("LOOP : ");*

  • Serial.println(loop_count);*

  • if(loop_count == 6 ){*

  • loop_count = 0;*

  • if(data1) { *

  • dtostrf(1, 1, 1, str_field1); *

  • }else{*

  • dtostrf(0.1, 2, 1, str_field1); *

  • }*

  • if(data2) {*

  • dtostrf(1, 1, 1, str_field2);*

  • }else{*

  • dtostrf(0.1, 2, 1, str_field2); *

  • }*

  • if(data3) {*

  • dtostrf(1, 1, 1, str_field3);*

  • }else{*

  • dtostrf(0.1, 2, 1, str_field3); *

  • }*

  • if(data4) {*

  • dtostrf(1, 1, 1, str_field4);*

  • }else{*

  • dtostrf(0.1, 2, 1, str_field4); *

  • }*

  • sprintf(buff, “//update?key=65OKK4T6SKM96AVO&field1=%s&field2=%s&field3=%s&field4=%s”,str_field1,str_field2,str_field3,str_field4);*

  • Serial.println(buff);*

_ rest.get((const char*)buff);_

  • Serial.println(“ARDUINO: Mengirim data terbaru”);*

  • if(rest.getResponse(response, 266) == HTTP_STATUS_OK){*

  • Serial.println(“ARDUINO: Berhasil GET Data”);*

  • strId = “”; strData = “”; strCode = “”;*

  • getData();*

  • }*

  • delay(5000);*

  • }*

  • }*

  • else{*

  • }*

}

void getData(){

  • int i=0,j=0,k=0;*

  • for (i = 0; i < 10; i++){ *

if((response == ‘\r’) || (response == ‘\n’)) {
* }*
* else{ *
_ strId += response*;
}*_

_ if (response == ‘\n’){
* i++;
break;
}
}*_

* Serial.println("");*
* Serial.print("ID : ");*
* Serial.print(strId);*

* for (j = i; j < (i+20); j++){*

* if((response[j] == ‘\r’) || (response[j] == ‘\n’)) {*
* }*
* else{ *
* strData += response[j]; *
* }*

* if (response[j] == ‘\n’){*
* j++; *
* break;*
* } *
* }*

* Serial.println("");*
* Serial.print("Data : ");*
* Serial.print(strData);*
* for (k = j; k < (j+10); k++){ *

* if((response[k] == ‘\r’) || (response[k] == ‘\n’)) {*
* }*
* else{ *
* strCode += response[k]; *
* }*

* if (response[k] == ‘\n’){ *
* break;*
* } *
* }*
* Serial.println("");*
* Serial.print("Code : ");*
* Serial.print(strCode); *
* Serial.println(""); *
* }*
* boolean hardReset() {*
* String tmpData;*
}

Tem a certeza que é esse erro que dá? Eu tentei compilar e dá-me outro (ou outro, melhor dizendo) erros!

PS.: Já agora aproveito para dizer que devia ter lido as regras do fórum antes de postar. Há formas de colocar o código num post, que facilitam a leitura e cópia, por exemplo.

Minhas desculpas com relação a postagem do código, vou dar uma verificada nas regras para repostar corretamente, obrigado, e sim para mim na IDE do Arduino só me dá esse erro!

O erro diz-te exactamente o que te falta... provavelmente também te diz a linha (que não indicaste aqui) que nos levaria ao sítio correcto no código.

No entanto, tenho de dizer que este código está extremamente feio e um erro desses não me espanta.

Olha aqui alguns exemplos:

 }
 
  else{
  }
 
}
          if((response == '\r') || (response == '\n')) {
          }
          else{         
             strId += response;     
          }