// https://www.reddit.com/r/FastLED/comments/1fbrnaz/stroboscopic_effect/
#include <FastLED.h>
#define NUM_LEDS 8
void setup() {
FastLED.addLeds<WS2812B, 3, GRB>(0, NUM_LEDS);
FastLED.setMaxRefreshRate(0, false);
}
// calculate how many microseconds between flashes for
// a given RPM
const int rpm = 600;
const int blades = 8;
const int fudge = 7;
const uint32_t rpm_us = 60000000 / rpm / blades - fudge;
void loop() {
// give the briefest possible flash
FastLED.showColor(CRGB::White);
FastLED.showColor(CRGB::Black);
// when should the next flash happen?
static uint64_t next_flash_us = micros();
if ((next_flash_us += rpm_us) < micros())
next_flash_us = micros();
// wait until the next flash is due
while (const uint64_t delay_us = next_flash_us - micros() < rpm_us)
delayMicroseconds(delay_us);
}