Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define LED_PIN 5 // Pin number connected to the LED strip
- #define NUM_LEDS 60 // Number of LEDs in the strip
- #define LED_TYPE WS2812B // Type of the LED strip
- #define COLOR_ORDER GRB // Color order of the LED strip
- CRGB leds[NUM_LEDS]; // Define an array of CRGB objects representing each LED
- void setup() {
- FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS); // Initialize the LED strip
- }
- void loop() {
- // Set your custom RGB values here (from 0 to 255 for each color)
- uint8_t r = 255; // Red value
- uint8_t g = 0; // Green value
- uint8_t b = 255; // Blue value
- // Set all LEDs to the custom color
- fill_solid(leds, NUM_LEDS, CRGB(r, g, b));
- // Show the updated LEDs
- FastLED.show();
- // Add a delay to control the speed of color changes
- delay(1000); // 1000 milliseconds = 1 second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement