sinric icon indicating copy to clipboard operation
sinric copied to clipboard

can you explain the usage of + in this line and help me solve my error

Open abhinav626 opened this issue 4 years ago • 0 comments

Serial.println("[WSc] SetThermostatMode value: " + value);

in else if(action == "SetThermostatMode") { //Alexa, set thermostat name to mode //Alexa, set thermostat to automatic //Alexa, set kitchen to off String value = json["value"]["thermostatMode"]["value"];

      Serial.println("[WSc] SetThermostatMode value: " + value);
     
    }

please explain the usage of +

and when i use this for my ac to set the mode using else if(action == "SetThermostatMode") { //Alexa, set thermostat name to mode //Alexa, set thermostat to automatic //Alexa, set kitchen to off String value = json["value"]["thermostatMode"]["value"];

      Serial.println("[WSc] SetThermostatMode value: " + value);
      _**String mod= + value      
            if (mod=="COOL"){
            ac.setMode(kSamsungAcCool);
            ac.send();}
            else if(mod=="HEAT"){
            ac.setMode(kSamsungAcHeat);
            ac.send();}**_
      
    }

i get this error C:\Users\DR v\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/WString.h:169:34: note: candidate expects 2 arguments, 1 provided C:\Users\DR v hema\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/WString.h:168:34: note: StringSumHelper& operator+(const StringSumHelper&, const String&) friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs); ^ C:\Users\DR v \AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/WString.h:168:34: note: candidate expects 2 arguments, 1 provided AC_alexa_samsung_revamp.txt:184:17: error: expected ',' or ';' before 'else' else if(mod=="HEAT"){ ^ exit status 1 no match for 'operator+' (operand type is 'String')

please help me

abhinav626 avatar Sep 30 '20 15:09 abhinav626