#include <FastLED.h>
#define NUM_LEDS 5
#define LED_PIN 15
const int potPin = 13,
switchPin = 27;
int currentLEDS = 0,
lastLEDS = 0;
CRGB leds[NUM_LEDS];
void IRAM_ATTR function_ISR() {
// currentLEDS = analogRead(potPin);
// currentLEDS = map(currentLEDS, 0, 4095, 0, 225);
// FastLED.clear();
// for (int led = 0; led < currentLEDS; led + 2) {
// leds[led] = CRGB::CRGB::Orange;
// }
// lastLEDS = currentLEDS;
// FastLED.show();
if (digitalRead(switchPin) == HIGH) {
FastLED.clear();
digitalWrite(2, HIGH);
for (int led = 0; led < NUM_LEDS; led ++) {
leds[led] = CRGB::Orange;
}
FastLED.show();
}
else {
FastLED.clear();
FastLED.show();
digitalWrite(2, LOW);
};
}
void setup() {
// analogReadResolution(10);
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS);
pinMode(switchPin, INPUT_PULLDOWN);
attachInterrupt(switchPin, function_ISR, CHANGE);
pinMode(2, OUTPUT);
}
void loop() {
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
strip1:DOUT
strip1:VDD
strip1:VSS
strip1:DIN
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r