Added Disco Mode

This commit is contained in:
2017-02-08 11:20:12 +01:00
parent 9a3b794d4b
commit cf8efa4e62
+17 -8
View File
@@ -11,7 +11,8 @@
//Lights: 4, 5, 6, 7, 8, 9, 10, 11, 12
//IP: 192.168.1.179
String url = "http://192.168.1.179/api/vncW9MBkPuGAc0Uy7hR4fAvW--V01PNGfMnCkDfr/lights/7/state";
String url_b = "http://192.168.1.179/api/vncW9MBkPuGAc0Uy7hR4fAvW--V01PNGfMnCkDfr/lights/";
String url_e = "/state";
String json_on_b = "{\"on\": true, \"hue\": ";
String json_on_e = "}";
@@ -36,8 +37,17 @@ void loop() {
HTTPClient http;
Serial.println("Updating light 7: " + state);
http.begin(url);
int i;
state = !state;
for(i = 4; i<13; i++)
{
String temp = "Updating light " + i;
temp += ": " + state;
Serial.println(temp);
http.begin(url_b + i + url_e);
int code = -1;
@@ -49,9 +59,6 @@ void loop() {
code = http.sendRequest("PUT", (json_on_b + rnd + json_on_e));
}
state = !state;
if(code == 200)
{
Serial.println("HTTP Success");
@@ -63,6 +70,8 @@ void loop() {
Serial.println("HTTP Failure");
http.end();
delay(3000);
delay(5);
}
delay(1500);
}