neuer sketch und germany svgs geadded
This commit is contained in:
parent
f7f768614b
commit
dc2b485ddc
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 158 KiB |
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 39 KiB |
|
@ -4,19 +4,21 @@
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define OWN_PIN 28
|
||||||
|
#define FREE_CYCLES 10
|
||||||
#define PIN 2
|
#define PIN 2
|
||||||
#define NUMPIXELS 12
|
#define NUMPIXELS 58
|
||||||
const char* ssid = "CTDO-LEGACY";
|
const char* ssid = "CTDO-LEGACY";
|
||||||
const char* password = "******";
|
const char* password = "****";
|
||||||
const char* apiEndpoint = "http://spacepanel.stablerock.de/leds";
|
const char* apiEndpoint = "http://spacepanel.stablerock.de/leds";
|
||||||
const int pollInterval = 10000;
|
const int pollInterval = 10000;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
|
|
||||||
|
|
||||||
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
|
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);
|
||||||
|
|
||||||
int delayval = 500;
|
int delayval = 500;
|
||||||
|
int freecycles = 0;
|
||||||
|
|
||||||
void setLED(int i, String value) {
|
void setLED(int i, String value) {
|
||||||
String value_short = value.substring(1);
|
String value_short = value.substring(1);
|
||||||
|
@ -34,8 +36,7 @@ void setLED(int i, String value) {
|
||||||
Serial.print(g);
|
Serial.print(g);
|
||||||
Serial.print(", ");
|
Serial.print(", ");
|
||||||
Serial.println(b);
|
Serial.println(b);
|
||||||
pixels.setPixelColor(i, pixels.Color(r/255,g/255,b/255));
|
pixels.setPixelColor(i, pixels.Color(r/25,g/25,b/25));
|
||||||
pixels.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
@ -62,16 +63,23 @@ void loop() {
|
||||||
DynamicJsonDocument doc(capacity);
|
DynamicJsonDocument doc(capacity);
|
||||||
deserializeJson(doc, json);
|
deserializeJson(doc, json);
|
||||||
for (int i = 0; i < NUMPIXELS; i++) {
|
for (int i = 0; i < NUMPIXELS; i++) {
|
||||||
Serial.print("LED" + String(i) + ": ");
|
if (i == OWN_PIN && freecycles < FREE_CYCLES) {
|
||||||
const char* element = doc[i];
|
setLED(i, "#00ff00");
|
||||||
String value = String(element);
|
}
|
||||||
setLED(i, value);
|
else {
|
||||||
Serial.print("LED" );
|
Serial.print("LED" + String(i) + ": ");
|
||||||
Serial.print(i);
|
const char* element = doc[i];
|
||||||
Serial.print("Color: ");
|
String value = String(element);
|
||||||
Serial.println(value);
|
setLED(i, value);
|
||||||
|
Serial.print("LED" );
|
||||||
|
Serial.print(i);
|
||||||
|
Serial.print("Color: ");
|
||||||
|
Serial.println(value);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
pixels.show();
|
||||||
|
freecycles++;
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Error: Statuscode" + httpCode);
|
Serial.println("Error: Statuscode" + httpCode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue