File tree Expand file tree Collapse file tree 6 files changed +52
-60
lines changed
Switch/MultiSwitch_advance Expand file tree Collapse file tree 6 files changed +52
-60
lines changed Original file line number Diff line number Diff line change 4242#define LOCK_ID " YOUR_DEVICE_ID_HERE" // Should look like "5dc1564130xxxxxxxxxxxxxx"
4343#define BAUD_RATE 9600 // Change baudrate to your need
4444
45- #ifdef ESP8266
46- #define LOCK_PIN D1 // PIN where the lock is connected to: HIGH = locked, LOW = unlocked
47- #define LOCK_STATE_PIN D2 // PIN where the lock feedback is connected to (HIGH:locked, LOW:unlocked)
48- #endif
49- #ifdef ESP32
50- #define LOCK_PIN 16 // PIN where the lock is connected to: HIGH = locked, LOW = unlocked
51- #define LOCK_STATE_PIN 17 // PIN where the lock feedback is connected to (HIGH:locked, LOW:unlocked)
45+ #if defined(ESP8266)
46+ #define LOCK_PIN D1 // PIN where the lock is connected to: HIGH = locked, LOW = unlocked
47+ #define LOCK_STATE_PIN D2 // PIN where the lock feedback is connected to (HIGH:locked, LOW:unlocked)
48+ #elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
49+ #define LOCK_PIN 16 // PIN where the lock is connected to: HIGH = locked, LOW = unlocked
50+ #define LOCK_STATE_PIN 17 // PIN where the lock feedback is connected to (HIGH:locked, LOW:unlocked)
5251#endif
5352
5453bool lastLockState;
Original file line number Diff line number Diff line change 3030#include < SinricPro.h>
3131#include < SinricProSwitch.h>
3232
33- #ifdef ESP8266
34- #define RELAYPIN_1 D1
35- #define RELAYPIN_2 D2
36- #define RELAYPIN_3 D3
37- #define RELAYPIN_4 D4
38- #define RELAYPIN_5 D5
39- #define RELAYPIN_6 D6
40- #define RELAYPIN_7 D7
41- #define RELAYPIN_8 D8
42- #endif
43- #ifdef ESP32
44- #define RELAYPIN_1 16
45- #define RELAYPIN_2 17
46- #define RELAYPIN_3 18
47- #define RELAYPIN_4 19
48- #define RELAYPIN_5 21
49- #define RELAYPIN_6 22
50- #define RELAYPIN_7 23
51- #define RELAYPIN_8 25
33+ #if defined(ESP8266)
34+ #define RELAYPIN_1 D1
35+ #define RELAYPIN_2 D2
36+ #define RELAYPIN_3 D3
37+ #define RELAYPIN_4 D4
38+ #define RELAYPIN_5 D5
39+ #define RELAYPIN_6 D6
40+ #define RELAYPIN_7 D7
41+ #define RELAYPIN_8 D8
42+ #elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
43+ #define RELAYPIN_1 16
44+ #define RELAYPIN_2 17
45+ #define RELAYPIN_3 18
46+ #define RELAYPIN_4 19
47+ #define RELAYPIN_5 21
48+ #define RELAYPIN_6 22
49+ #define RELAYPIN_7 23
50+ #define RELAYPIN_8 25
5251#endif
5352
5453/* ****************
Original file line number Diff line number Diff line change 3535#define SWITCH_ID " YOUR-DEVICE-ID" // Should look like "5dc1564130xxxxxxxxxxxxxx"
3636#define BAUD_RATE 9600 // Change baudrate to your need
3737
38- #ifdef ESP8266
39- #define RELAY_PIN D5 // Pin where the relay is connected (D5 = GPIO 14 on ESP8266)
40- #endif
41-
42- #ifdef ESP32
43- #define RELAY_PIN 16 // Pin where the relay is connected (GPIO 16 on ESP32)
38+ #if defined(ESP8266)
39+ #define RELAY_PIN D5 // Pin where the relay is connected (D5 = GPIO 14 on ESP8266)
40+ #elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
41+ #define RELAY_PIN 16 // Pin where the relay is connected (GPIO 16 on ESP32)
4442#endif
4543
4644bool onPowerState (const String &deviceId, bool &state) {
Original file line number Diff line number Diff line change 5454
5555#define DEBOUNCE_TIME 250
5656
57- #ifdef ESP8266
58- #define RELAYPIN_1 D1
59- #define RELAYPIN_2 D2
60- #define RELAYPIN_3 D3
61- #define RELAYPIN_4 D4
62- #define SWITCHPIN_1 D8
63- #define SWITCHPIN_2 D7
64- #define SWITCHPIN_3 D6
65- #define SWITCHPIN_4 D5
66- #endif
67-
68- #ifdef ESP32
69- #define LED_BUILTIN 2
70-
71- #define RELAYPIN_1 16
72- #define RELAYPIN_2 17
73- #define RELAYPIN_3 18
74- #define RELAYPIN_4 19
75- #define SWITCHPIN_1 25
76- #define SWITCHPIN_2 26
77- #define SWITCHPIN_3 22
78- #define SWITCHPIN_4 21
57+ #if defined(ESP8266)
58+ #define RELAYPIN_1 D1
59+ #define RELAYPIN_2 D2
60+ #define RELAYPIN_3 D3
61+ #define RELAYPIN_4 D4
62+ #define SWITCHPIN_1 D8
63+ #define SWITCHPIN_2 D7
64+ #define SWITCHPIN_3 D6
65+ #define SWITCHPIN_4 D5
66+ #elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
67+ #define LED_BUILTIN 2
68+
69+ #define RELAYPIN_1 16
70+ #define RELAYPIN_2 17
71+ #define RELAYPIN_3 18
72+ #define RELAYPIN_4 19
73+ #define SWITCHPIN_1 25
74+ #define SWITCHPIN_2 26
75+ #define SWITCHPIN_3 22
76+ #define SWITCHPIN_4 21
7977#endif
8078
8179typedef struct { // struct for the std::map below
Original file line number Diff line number Diff line change 4545#define BAUD_RATE 9600 // Change baudrate to your need (used for serial monitor)
4646#define EVENT_WAIT_TIME 60000 // send event every 60 seconds
4747
48- #ifdef ESP8266
48+ #if defined( ESP8266)
4949 #define DHT_PIN D5
50- #endif
51- #ifdef ESP32
50+ #elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
5251 #define DHT_PIN 5
5352#endif
5453
Original file line number Diff line number Diff line change @@ -48,11 +48,10 @@ Adafruit_HTU21DF htu = Adafruit_HTU21DF();
4848#define BAUD_RATE 9600 // Change baudrate to your need (used for serial monitor)
4949#define EVENT_WAIT_TIME 60000
5050
51- #ifdef ESP8266
51+ #if defined( ESP8266)
5252 #define I2C_SCL 14 // D5
5353 #define I2C_SDA 12 // D6
54- #endif
55- #ifdef ESP32
54+ #elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
5655 #define I2C_SCL 18
5756 #define I2C_SDA 19
5857#endif
You can’t perform that action at this time.
0 commit comments