That's right : the line FastLED.show(); was not correctly placed too (I can't run the code here, so I' m kind of blind when checking it) :
#include <FastLED.h>
// Define the array of leds
#define LED_DT 6
#define COLOR_ORDER GRB
#define LED_TYPE WS2812
#define NUM_LEDS 150
uint8_t max_bright = 255;
struct CRGB leds[NUM_LEDS];
void setLEDs (int K, int N) {
FastLED.clear();
for (int i = 0; i < NUM_LEDS; i++) {
if (i % N == K) leds[i].setRGB (127, 0, 0); // set red LED
}
FastLED.show();
}
void setup() {
delay (1000);
LEDS.addLeds<LED_TYPE, LED_DT, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(max_bright);
}
void loop() {
int N = 5;
for (int i = 0; i < N; i++) {
setLEDs (i, N);
delay (50);
}
}
You can play with colors in the function, for example :
void setLEDs (int K, int N) {
FastLED.clear();
for (int i = 0; i < NUM_LEDS; i++) {
int red = 255 * (i % N) / (N - 1);
int blu = 255 - red;
if (i % N == K) leds[i].setRGB (red, 0, blu); // set changing color
}
FastLED.show();
}
(unless I did other mistakes) this should chnage the color of the lit LEDs from red to blue, then back to red again.