Example Code for Arduino-Flowing Water Lighting Effect 1

Last revision 2026/01/15

This example demonstrates a flowing water lighting effect using the WS2812B Ring Lamp with Arduino. Users can learn how to control WS2812B LEDs using the FastLED library.

Hardware Preparation

Software Preparation

Wiring Diagram

Connection Diagram

Sample Code

#include <FastLED.h>
#define LED_PIN     6
#define NUM_LEDS    93
CRGB leds[NUM_LEDS];
void setup() {
  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
  for (int i = 0; i <= 93; i++) {
    leds[i] = CRGB ( 0, 0, 255);
    FastLED.show();
    delay(40);
  }
  for (int i = 0; i <= 93; i++) {
    leds[i] = CRGB ( 255, 0, 0);
    FastLED.show();
    delay(40);
  }
  for (int i = 0; i <= 93; i++) {
    leds[i] = CRGB ( 0, 255, 0);
    FastLED.show();
    delay(40);
  }
}

Was this article helpful?

TOP