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>
|
||||
|
||||
|
||||
|
||||
#define OWN_PIN 28
|
||||
#define FREE_CYCLES 10
|
||||
#define PIN 2
|
||||
#define NUMPIXELS 12
|
||||
#define NUMPIXELS 58
|
||||
const char* ssid = "CTDO-LEGACY";
|
||||
const char* password = "******";
|
||||
const char* password = "****";
|
||||
const char* apiEndpoint = "http://spacepanel.stablerock.de/leds";
|
||||
const int pollInterval = 10000;
|
||||
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 freecycles = 0;
|
||||
|
||||
void setLED(int i, String value) {
|
||||
String value_short = value.substring(1);
|
||||
|
@ -34,8 +36,7 @@ void setLED(int i, String value) {
|
|||
Serial.print(g);
|
||||
Serial.print(", ");
|
||||
Serial.println(b);
|
||||
pixels.setPixelColor(i, pixels.Color(r/255,g/255,b/255));
|
||||
pixels.show();
|
||||
pixels.setPixelColor(i, pixels.Color(r/25,g/25,b/25));
|
||||
}
|
||||
|
||||
void setup() {
|
||||
|
@ -62,16 +63,23 @@ void loop() {
|
|||
DynamicJsonDocument doc(capacity);
|
||||
deserializeJson(doc, json);
|
||||
for (int i = 0; i < NUMPIXELS; i++) {
|
||||
Serial.print("LED" + String(i) + ": ");
|
||||
const char* element = doc[i];
|
||||
String value = String(element);
|
||||
setLED(i, value);
|
||||
Serial.print("LED" );
|
||||
Serial.print(i);
|
||||
Serial.print("Color: ");
|
||||
Serial.println(value);
|
||||
if (i == OWN_PIN && freecycles < FREE_CYCLES) {
|
||||
setLED(i, "#00ff00");
|
||||
}
|
||||
else {
|
||||
Serial.print("LED" + String(i) + ": ");
|
||||
const char* element = doc[i];
|
||||
String value = String(element);
|
||||
setLED(i, value);
|
||||
Serial.print("LED" );
|
||||
Serial.print(i);
|
||||
Serial.print("Color: ");
|
||||
Serial.println(value);
|
||||
}
|
||||
|
||||
}
|
||||
pixels.show();
|
||||
freecycles++;
|
||||
} else {
|
||||
Serial.println("Error: Statuscode" + httpCode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue