use pre-defined led pin

This commit is contained in:
Nicu Hodos 2023-07-11 23:16:10 +02:00
parent b5e91195e7
commit 584fa688c3

View File

@ -21,7 +21,6 @@ Task tButton(TASK_IMMEDIATE, TASK_ONCE, onButtonCallback, &ts);
#include "ir.h"
#define BUTTON D3
#define LED D4
void setup() {
@ -42,7 +41,7 @@ void setup() {
pinMode(BUTTON, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(BUTTON), onButtonPressed, FALLING);
attachInterrupt(digitalPinToInterrupt(LED), onLed, CHANGE);
attachInterrupt(digitalPinToInterrupt(LED_BUILTIN), onLed, CHANGE);
}
void loop() {
@ -74,7 +73,7 @@ ICACHE_RAM_ATTR void onButtonPressed() {
}
ICACHE_RAM_ATTR void onLed() {
Mqtt::publish(Mqtt::ledMqtt->stateTopic, digitalRead(LED) ? "OFF" : "ON");
Mqtt::publish(Mqtt::ledMqtt->stateTopic, digitalRead(LED_BUILTIN) ? "OFF" : "ON");
}
void onButtonCallback() {