but need change this part: red=1&green=0&blue=0
for a variable composed by string and int.
Somethign like this:
int valred = red==HIGH ? '1' : '0'; //= this is like to digitalread, i think.
string red = "red";
int valgreen = green==HIGH ? '1' : '0'; //= this is like to digitalread, i think.
string red = "green";
int valblue = blue==HIGH ? '1' : '0'; //= this is like to digitalread, i think.
string red = "blue";
varleds = red=1&green=1&blue=1
char url[50] = "GET /arduino/getstate.php?color=All"; //Solo necesito las ordenes
char host[100] = " HTTP/1.1\r\nHost: xx.xx.xx.xx";
char host2[100] = "\r\nConnection: close\r\n\r\n";
strcat(url, host);
strcat(url, varleds);
strcat(url,host2);
void setup()
{
char buffer[100]; //somewhere to store the result
int red = 1;
int green = 2;
int blue = 3;
Serial.begin(115200);
while (!Serial);
snprintf(buffer, 99, "HTTP/1.1\\r\\nHost: xx.xx.xx.xx\\r\\nred=%d&green=%d&blue=%d\\r\\nConnection: close\\r\\n\\r\\n", red, green, blue);
Serial.println(buffer);
red = 123;
green = 321;
green = 255;
snprintf(buffer, 99, "HTTP/1.1\\r\\nHost: xx.xx.xx.xx\\r\\nred=%d&green=%d&blue=%d\\r\\nConnection: close\\r\\n\\r\\n", red, green, blue);
Serial.println(buffer);
}
void loop()
{
}
Note the use of \ to print a single backslash and the length parameter in snprintf()