From fb59f1f0a0e6d710f7e5b0402184334ed48c73ab Mon Sep 17 00:00:00 2001 From: srg74 <28492985+srg74@users.noreply.github.com> Date: Fri, 21 Feb 2020 16:55:58 -0500 Subject: [PATCH] Update wled06_usermod.ino --- .../wled06_usermod.ino | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/usermods/Wemos_D1_mini+Wemos32_mini_shield/wled06_usermod.ino b/usermods/Wemos_D1_mini+Wemos32_mini_shield/wled06_usermod.ino index 0e1b1e66..9e6e0b79 100644 --- a/usermods/Wemos_D1_mini+Wemos32_mini_shield/wled06_usermod.ino +++ b/usermods/Wemos_D1_mini+Wemos32_mini_shield/wled06_usermod.ino @@ -1,17 +1,20 @@ #include // from https://github.com/olikraus/u8g2/ #include //Dallastemperature sensor - +#ifdef ARDUINO_ARCH_ESP32 //ESP32 boards +uint8_t SCL_PIN = 22; +uint8_t SDA_PIN = 21; +OneWire oneWire(23); +#else //ESP8266 boards +uint8_t SCL_PIN = 5; +uint8_t SDA_PIN = 4; +OneWire oneWire(13); +#endif //The SCL and SDA pins are defined here. -//ESP8266 Wemos D1 mini boards use SCL=5 SDA=4 -#define U8X8_PIN_SCL 5 -#define U8X8_PIN_SDA 4 -//ESP32 Wemos32 mini boards use SCL=22 SDA=21 -//#define U8X8_PIN_SCL 22 -//#define U8X8_PIN_SDA 21 +//ESP8266 Wemos D1 mini board use SCL=5 SDA=4 while ESP32 Wemos32 mini board use SCL=22 SDA=21 +#define U8X8_PIN_SCL SCL_PIN +#define U8X8_PIN_SDA SDA_PIN // Dallas sensor -OneWire oneWire(13); //ESP8266 boards -//OneWire oneWire(23); //ESP32 boards DallasTemperature sensor(&oneWire); long temptimer = millis(); long lastMeasure = 0; @@ -210,4 +213,4 @@ void userLoop() { u8x8.drawGlyph(0, 1, 68); // home icon u8x8.setFont(u8x8_font_open_iconic_weather_2x2); u8x8.drawGlyph(0, 2, 66 + (bri > 0 ? 3 : 0)); // sun/moon icon -} \ No newline at end of file +}