Go Down

Topic: Troubles with controlling leds (neoPixel) (Read 480 times) previous topic - next topic

Gollex

Hey,

I am trying to change the color of my 8-led strip to values from array. However, I think I am not giving the strip.Color correct kind of input as it gives me an error "'array' was not declared in this scope". Could someone help me a bit with this part of the code? Thx a lot beforehand!!!


Code: [Select]

  int array[2][8][3] = {
    {{124, 109, 39},{124, 109, 39},{124, 109, 39},{124, 109, 39},{124, 109, 39},{124, 109, 39},{124, 109, 39},{124, 109, 39}},
    {{45, 83, 199}, {45, 83, 199}, {45, 83, 199}, {45, 83, 199}, {45, 83, 199}, {45, 83, 199}, {45, 83, 199}, {45, 83, 199}}
  };



void fromArray(uint8_t wait){
  for(int i=0; i<2; i++){
    for (int j=0; j<strip.numPixels(); j++){
      strip.setPixelColor(j, strip.Color(array[i][j]));
    }
    strip.show();
    delay(wait)
  }
}



Grumpy_Mike

Quote
Could someone help me a bit with this part of the code?
No because your error is not in the bit of the code you posted. You have to post all the code then we can try it and see what is wrong.

Please read this:-
How to use this forum

PaulRB

#2
Apr 30, 2016, 08:53 am Last Edit: Apr 30, 2016, 08:56 am by PaulRB
Mike is correct, you should always post your full code, but in this case i think i see the problem, or part of it. Try this:

Code: [Select]
strip.Color(array[i][j][0],array[i][j][1],array[i][j][2])

Paul

Go Up