AHHHHHH
This commit is contained in:
parent
47b1a0c730
commit
879e74cfc2
1 changed files with 8 additions and 3 deletions
11
src/main.cpp
11
src/main.cpp
|
@ -51,7 +51,8 @@ void connectWiFi() {
|
||||||
|
|
||||||
|
|
||||||
String getTopicNameString(String topic) {
|
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);
|
Serial.println("TopicName: "+topicName);
|
||||||
return topicName;
|
return topicName;
|
||||||
}
|
}
|
||||||
|
@ -80,8 +81,11 @@ void connectMQTT() {
|
||||||
}
|
}
|
||||||
digitalWrite(LED_BUILTIN, HIGH);
|
digitalWrite(LED_BUILTIN, HIGH);
|
||||||
Serial.println("Subscribe");
|
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(getTopicName("/#"));
|
||||||
client.subscribe("led2/#");
|
//client.subscribe("led1/#");
|
||||||
|
client.subscribe("#");
|
||||||
client.publish(getTopicName("/status"), "1", true);
|
client.publish(getTopicName("/status"), "1", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +105,7 @@ void writeToLedStrips(LEDStripe *l1, LEDStripe *l2) {
|
||||||
analogWrite(BLUEPIN1, l1->BLUE);
|
analogWrite(BLUEPIN1, l1->BLUE);
|
||||||
analogWrite(BLUEPIN2, l2->BLUE);
|
analogWrite(BLUEPIN2, l2->BLUE);
|
||||||
debugLoop++;
|
debugLoop++;
|
||||||
if(debugLoop > 500) {
|
if(debugLoop > 50) {
|
||||||
Serial.println("LED1: "+String(l1->RED)+"|"+String(l1->GREEN)+"|"+String(l1->BLUE));
|
Serial.println("LED1: "+String(l1->RED)+"|"+String(l1->GREEN)+"|"+String(l1->BLUE));
|
||||||
Serial.println("LED2: "+String(l2->RED)+"|"+String(l2->GREEN)+"|"+String(l2->BLUE));
|
Serial.println("LED2: "+String(l2->RED)+"|"+String(l2->GREEN)+"|"+String(l2->BLUE));
|
||||||
debugLoop = 0;
|
debugLoop = 0;
|
||||||
|
@ -205,6 +209,7 @@ void setup() {
|
||||||
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
//Serial.println(".");
|
||||||
if (!client.connected()) {
|
if (!client.connected()) {
|
||||||
connectMQTT();
|
connectMQTT();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue