Hello Everyone! I’m a newbie Arduino hobbyist trying to build a seven segment display using Neopixels. I’m stuck with a problem that you can see on this video:
https://www.youtube.com/my_videos?o=U
All the displays should show solid red, but I have always one display showing wrong colors. This is not a HW problem as if I turn the pins around (either physically or in code) the problem follows leds[0]. Independently on which board, pin or number is drawn into leds[0].
Help would be highly appreciated!
#include “FastLED.h”
//
// * Ledien alustaminen *
//
#define NUM_LEDS_NUMEROT 21
#define DATA_PIN_1 2
#define DATA_PIN_2 3
#define DATA_PIN_3 4
#define NUM_NAYTTO 3
CRGB leds[NUM_NAYTTO][NUM_LEDS_NUMEROT]; // .
int Numero_0[] = {0,1,2, 3,4,5, 6,7,8, 9,10,11, 12,13,14, 15,16,17};
int Numero_1[] = {12,13,14, 15,16,17};
int Numero_2[] = {0,1,2, 3,4,5, 9,10,11, 12,13,14, 18,19,20};
int Numero_3[] = {0,1,2, 9,10,11, 12,13,14, 15,16,17, 18,19,20};
int Numero_4[] = {6,7,8, 12,13,14, 15,16,17, 18,19,20};
int Numero_5[] = {0,1,2, 6,7,8, 9,10,11, 15,16,17, 18,19,20};
int Numero_6[] = {0,1,2, 3,4,5, 6,7,8, 9,10,11, 15,16,17, 18,19,20};
int Numero_7[] = {9,10,11, 12,13,14, 15,16,17,};
int Numero_8[] = {0,1,2, 3,4,5, 6,7,8, 9,10,11, 12,13,14, 15,16,17, 18,19,20};
int Numero_9[] = {6,7,8, 9,10,11, 12,13,14, 15,16,17, 18,19,20};
//
// * Nayttöjen alustaminen *
//
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN_1>(leds[0], NUM_LEDS_NUMEROT);
FastLED.addLeds<NEOPIXEL, DATA_PIN_2>(leds[1], NUM_LEDS_NUMEROT);
FastLED.addLeds<NEOPIXEL, DATA_PIN_3>(leds[2], NUM_LEDS_NUMEROT);
}
void loop() {
FastLED.clear();
Piirra (0, Numero_8, (sizeof(Numero_8) / sizeof(int)));
Piirra (1, Numero_8, (sizeof(Numero_8) / sizeof(int)));
Piirra (2, Numero_8, (sizeof(Numero_8) / sizeof(int)));
FastLED.show();
delay(1000);
}
//
// * Piirra *
//
void Piirra (int naytto, int Numero[], int koko) {
for(int i = 0; i < koko; i++) {
leds[naytto][(Numero[i])] = CRGB::Red;
}
}