I’m trying to generate a WebServer for a relay, and i stumbled across an error and i dont know how to fix it. Ive tried moving it out of the for loop but it doesn’t fix it.
String processor(const String& var){
//Serial.println(var);
if(var == "BUTTONPLACEHOLDER"){
String buttons ="";
for(int i=1; i<=NUM_RELAYS; i++){
String relayStateValue = relayState(i);
buttons+= "<h4>Relay #" + String(i) + " - GPIO " + relayGPIOs[i-1] + "</h4><label class=\"switch\"><input type=\"checkbox\" onchange=\"toggleCheckbox(this)\" id=\"" + String(i) + "\" "+ relayStateValue +"><span class=\"slider\"></span></label>";
}
return buttons;
}
return String();
}
This is the output i get:
src/main.cpp: In function 'String processor(const String&)':
src/main.cpp:59:44: error: 'relayState' was not declared in this scope
String relayStateValue = relayState(i);
^
I’m still new to Arduino coding and cpp, so I’m not really sure at what I’m looking for right now