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 42
42
#define LOCK_ID " YOUR_DEVICE_ID_HERE" // Should look like "5dc1564130xxxxxxxxxxxxxx"
43
43
#define BAUD_RATE 9600 // Change baudrate to your need
44
44
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)
52
51
#endif
53
52
54
53
bool lastLockState;
Original file line number Diff line number Diff line change 30
30
#include < SinricPro.h>
31
31
#include < SinricProSwitch.h>
32
32
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
52
51
#endif
53
52
54
53
/* ****************
Original file line number Diff line number Diff line change 35
35
#define SWITCH_ID " YOUR-DEVICE-ID" // Should look like "5dc1564130xxxxxxxxxxxxxx"
36
36
#define BAUD_RATE 9600 // Change baudrate to your need
37
37
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)
44
42
#endif
45
43
46
44
bool onPowerState (const String &deviceId, bool &state) {
Original file line number Diff line number Diff line change 54
54
55
55
#define DEBOUNCE_TIME 250
56
56
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
79
77
#endif
80
78
81
79
typedef struct { // struct for the std::map below
Original file line number Diff line number Diff line change 45
45
#define BAUD_RATE 9600 // Change baudrate to your need (used for serial monitor)
46
46
#define EVENT_WAIT_TIME 60000 // send event every 60 seconds
47
47
48
- #ifdef ESP8266
48
+ #if defined( ESP8266)
49
49
#define DHT_PIN D5
50
- #endif
51
- #ifdef ESP32
50
+ #elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
52
51
#define DHT_PIN 5
53
52
#endif
54
53
Original file line number Diff line number Diff line change @@ -48,11 +48,10 @@ Adafruit_HTU21DF htu = Adafruit_HTU21DF();
48
48
#define BAUD_RATE 9600 // Change baudrate to your need (used for serial monitor)
49
49
#define EVENT_WAIT_TIME 60000
50
50
51
- #ifdef ESP8266
51
+ #if defined( ESP8266)
52
52
#define I2C_SCL 14 // D5
53
53
#define I2C_SDA 12 // D6
54
- #endif
55
- #ifdef ESP32
54
+ #elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
56
55
#define I2C_SCL 18
57
56
#define I2C_SDA 19
58
57
#endif
You can’t perform that action at this time.
0 commit comments