From ab83b5118ce11e64759dfc1491a420cea51317fe Mon Sep 17 00:00:00 2001 From: Eric Duminil <eric.duminil@gmail.com> Date: Fri, 18 Dec 2020 20:39:33 +0100 Subject: [PATCH] Moving LED from GPIO5 to GPIO23 on ESP32 --- led_effects.cpp | 12 +++++++----- led_effects.h | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/led_effects.cpp b/led_effects.cpp index 2b15d6f..b2f51bf 100644 --- a/led_effects.cpp +++ b/led_effects.cpp @@ -18,12 +18,14 @@ namespace config //TODO: Use a class instead. NightMode could then be another s bool night_mode = false; } -// Adafruit NeoPixel (Arduino library for controlling single-wire-based LED pixels and strip) -// https://github.com/adafruit/Adafruit_NeoPixel -// Documentation : http://adafruit.github.io/Adafruit_NeoPixel/html/class_adafruit___neo_pixel.html - -// NeoPixels on GPIO05, aka D1 on ESP8266 or 5 on ESP32. +#if defined(ESP8266) +// NeoPixels on GPIO05, aka D1 on ESP8266. const int NEOPIXELS_PIN = 5; +#elif defined(ESP32) +// NeoPixels on GPIO23 on ESP32. To avoid conflict with LoRa_SCK on TTGO. +const int NEOPIXELS_PIN = 23; +#endif + const int NUMPIXELS = 12; //NOTE: One value has been prepended, to make calculations easier and avoid out of bounds index. const uint16_t CO2_TICKS[NUMPIXELS + 1] = { 0, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1600, 1800, 2000, 2200 }; // [ppm] diff --git a/led_effects.h b/led_effects.h index b074f53..a8d5b59 100644 --- a/led_effects.h +++ b/led_effects.h @@ -3,6 +3,10 @@ #include <Arduino.h> #include "util.h" #include "config.h" + +// Adafruit NeoPixel (Arduino library for controlling single-wire-based LED pixels and strip) +// https://github.com/adafruit/Adafruit_NeoPixel +// Documentation : http://adafruit.github.io/Adafruit_NeoPixel/html/class_adafruit___neo_pixel.html #include "src/lib/Adafruit_NeoPixel/Adafruit_NeoPixel.h" namespace color { -- GitLab