This commit is contained in:
Kekskurse 2020-01-22 23:01:59 +01:00
parent 47b1a0c730
commit 879e74cfc2

View file

@ -51,7 +51,8 @@ void connectWiFi() {
String getTopicNameString(String topic) {
String topicName = String(MQTT_TOPIC_START)+String(topic);
//String topicName = String(MQTT_TOPIC_START)+String(topic);
String topicName = String("led1")+String(topic);
Serial.println("TopicName: "+topicName);
return topicName;
}
@ -80,8 +81,11 @@ void connectMQTT() {
}
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("Subscribe");
Serial.println(getTopicName("/#"));
// @todo rausfinden warum es ein "encoding" like fehler gibt wenn die getTopicName methode benutzt wird.
//client.subscribe(getTopicName("/#"));
client.subscribe("led2/#");
//client.subscribe("led1/#");
client.subscribe("#");
client.publish(getTopicName("/status"), "1", true);
}
@ -101,7 +105,7 @@ void writeToLedStrips(LEDStripe *l1, LEDStripe *l2) {
analogWrite(BLUEPIN1, l1->BLUE);
analogWrite(BLUEPIN2, l2->BLUE);
debugLoop++;
if(debugLoop > 500) {
if(debugLoop > 50) {
Serial.println("LED1: "+String(l1->RED)+"|"+String(l1->GREEN)+"|"+String(l1->BLUE));
Serial.println("LED2: "+String(l2->RED)+"|"+String(l2->GREEN)+"|"+String(l2->BLUE));
debugLoop = 0;
@ -205,6 +209,7 @@ void setup() {
void loop() {
//Serial.println(".");
if (!client.connected()) {
connectMQTT();
}