Я пытаюсь заставить мой светодиод мигать каждые 2 секунды, используя миллис. Задержка невозможна, так как у меня работают другие датчики.
Пока я получил это, но, похоже, он не работает
#include "FastLED.h"
#define NUM_LEDS 12 // number of LEDS in neopixel ring
#define DATA_PIN 10 // for neopixel ring
CRGB leds[NUM_LEDS];
long period = 2000;
long currentMillis = 0;
long startMillis = 0;
void setup() {
FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
}
void loop() {
currentMillis = millis();
if (currentMillis - startMillis >= period) {
startMillis = currentMillis;
leds[7]=CRGB(255,0,0);
FastLED.show();
}
}