You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
unsignedlong actualMillis = millis(); // get actual millis() and keep it in variable actualMillis
71
-
if (digitalRead(BTN_FLASH) == LOW && actualMillis - lastBtnPress > 1000) { // is button pressed (inverted logic! button pressed = LOW) and debounced?
72
+
if (digitalRead(BUTTON_PIN) == LOW && actualMillis - lastBtnPress > 1000) { // is button pressed (inverted logic! button pressed = LOW) and debounced?
72
73
if (myPowerState) { // flip myPowerState: if it was true, set it to false, vice versa
73
74
myPowerState = false;
74
75
} else {
75
76
myPowerState = true;
76
77
}
77
-
digitalWrite(LED_BUILTIN, myPowerState?LOW:HIGH); // if myPowerState indicates device turned on: turn on led (builtin led uses inverted logic: LOW = LED ON / HIGH = LED OFF)
78
+
digitalWrite(LED_PIN, myPowerState?LOW:HIGH); // if myPowerState indicates device turned on: turn on led (builtin led uses inverted logic: LOW = LED ON / HIGH = LED OFF)
78
79
79
80
// get Switch device back
80
81
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
@@ -96,7 +97,7 @@ void setupWiFi() {
96
97
delay(250);
97
98
}
98
99
IPAddress localIP = WiFi.localIP();
99
-
Serial.printf("connected!\r\n[WiFi]: IP-Address is %d.%d.%d.%d\r\n", localIP[0], localIP[1], localIP[2], localIP[3]);
100
+
Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", localIP[0], localIP[1], localIP[2], localIP[3]);
100
101
}
101
102
102
103
// setup function for SinricPro
@@ -115,9 +116,9 @@ void setupSinricPro() {
115
116
116
117
// main setup function
117
118
voidsetup() {
118
-
pinMode(BTN_FLASH, INPUT_PULLUP); // GPIO 0 as input, pulled high
119
-
pinMode(LED_BUILTIN, OUTPUT); // define LED GPIO as output
120
-
digitalWrite(LED_BUILTIN, HIGH); // turn off LED on bootup
119
+
pinMode(BUTTON_PIN, INPUT_PULLUP); // GPIO 0 as input, pulled high
120
+
pinMode(LED_PIN, OUTPUT); // define LED GPIO as output
121
+
digitalWrite(LED_PIN, HIGH); // turn off LED on bootup
0 commit comments