Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FastLED.h"
- FASTLED_USING_NAMESPACE
- // DEFINITIONS
- #define LED_TYPE_4W WS2801
- #define CLOCK_PIN 2
- #define LED_STRIP_1_PIN 14
- #define LED_STRIP_1_NUM 37
- #define COLOR_ORDER BGR
- #define NUM_LEDS LED_STRIP_1_NUM // +other substrips which I removed from this example
- // Define the start (STRIP_x_L) and end (STRIP_x_H) index of each LED substrip
- #define STRIP_1_L 0
- #define STRIP_1_H (LED_STRIP_1_NUM - 1)
- // Generate array of LEDs containing the LEDs of all strips
- CRGB leds[NUM_LEDS];
- // Initialise all LED substrips.
- FastLED.addLeds<LED_TYPE_4W, LED_STRIP_1_PIN, CLOCK_PIN, COLOR_ORDER>(leds, STRIP_1_L, LED_STRIP_1_NUM);
- // Reverse some of the substrips
- int counter, saver;
- for (counter = STRIP_1_L; counter < (STRIP_1_L + LED_STRIP_1_NUM / 2); counter++) {
- saver = leds[counter];
- leds[counter] = leds[STRIP_1_H - counter];
- leds[STRIP_1_H - counter] = saver;
- }
- // Now I run a dot from leds[0] to leds[end]
- for (int dot = 0; dot < NUM_LEDS; dot++) { // red moving dot
- leds[dot] = CRGB::Red;
- FastLED.show();
- leds[dot] = CRGB::Black;
- FastLED.delay(30); // wait for 30 ms
- }
- FastLED.show(); // all LEDs black again
- // This is the problem, even though I reversed the array. The red dot still start on the side where the LED strip is connected with the // wires. It should start on the opposite side. Please help to fix this!
Add Comment
Please, Sign In to add comment