Hey so im trying to make an array for this LED so it can contentiously flash blue. The main issue is that when im checking to see the serial printed value, its onlly sending 255 to the LED, not the entire array and even the LED doesn't light up. This is the sketch:
byte sh[] = {255, 200, 150, 100, 50, 25, 10, 0}; / 8 elements for the array
else if (b == 0 && x == 1 && y == 1 && a == 1 && (ax >= 340 && ax <= 375) && (ay <= 250)) // B + down
{
for (int ixx=0; ixx<4; ixx++) // go through the different number of leds
for (int i = 0; i < 8; i++) // go through the elements in the array
strip.setPixelColor(ixx, 0, 0, sh[i]);
strip.show();
timer1 = millis();
bydPressed = Millis;
Serial.println(sh[i]);
}
when im checking the serial monitor, its only sending over 255, however the leds arent even turning on. How can i make it properly go through all 8 elements and light the up the leds accordingly?
There is bound to be a problem when you only show us part of your code.
You are missing some curly braces { and }. Spaces and blank lines may help YOU but are mostly ignored by the compiler.
Your two "for" statements end at the first following semicolon.
Perhaps you intended
byte sh[] = {255, 200, 150, 100, 50, 25, 10, 0}; / 8 elements for the array
else if (b == 0 && x == 1 && y == 1 && a == 1 && (ax >= 340 && ax <= 375) && (ay <= 250)) // B + down
{
for (int ixx=0; ixx<4; ixx++) { // go through the different number of leds
for (int i = 0; i < 8; i++) { // go through the elements in the array
strip.setPixelColor(ixx, 0, 0, sh[i]);
strip.show();
timer1 = millis();
bydPressed = Millis;
Serial.println(sh[i]);
}
}
}
vaj4088:
There is bound to be a problem when you only show us part of your code.
You are missing some curly braces { and }. Spaces and blank lines may help YOU but are mostly ignored by the compiler.
Your two "for" statements end at the first following semicolon.
Perhaps you intended
byte sh[] = {255, 200, 150, 100, 50, 25, 10, 0}; / 8 elements for the array
else if (b == 0 && x == 1 && y == 1 && a == 1 && (ax >= 340 && ax <= 375) && (ay <= 250)) // B + down
{
for (int ixx=0; ixx<4; ixx++) { // go through the different number of leds
for (int i = 0; i < 8; i++) { // go through the elements in the array
strip.setPixelColor(ixx, 0, 0, sh[i]);
strip.show();
timer1 = millis();
bydPressed = Millis;
Serial.println(sh[i]);
}
}
}