So, I actually managed to get the LEDs to initiate simultaneously with the NeoPixel, using the millis() function.
@Grumpy_Mike I suppose that the remedy you just prescribed would result in the same.
My issue is, and I realize that I did not specify this prior, that the LED stays on for as long as it takes for the NeoPixel to complete its pulse (which I defined as 3 seconds). I actually want the LED to stay on for about 1 second and the NeoPixel pulse cycle to complete after 3 seconds.
I attempted to code the Neopixel pulse with a separate millis() clause; however, the LED and neopixel duration still seem set to complete over the same time. I also tried to replace the delay(15) within the pulse codes with a millis() condition; however, this would simply prevent any of the components from working in the circuit (perhaps it was written incorrectly).
Here is a copy of the [void loop(void)] code that has the LED on as long as the NeoPixel takes to pulse.
void loop(void)
{
uint8_t len = readPacket(&bleuart, 500);
if (len == 0) return;
if (packetbuffer[1] == 'B') {
uint8_t buttnum = packetbuffer[2] - '0';
boolean pressed = packetbuffer[3] - '0';
unsigned long currentMillis = millis();
if (pressed)
{
if(buttnum == 5) {
//Serial.println("button1");
digitalWrite(ledPinON, HIGH);
brightenON();
darkenON();
}
if((buttnum == 5) && (currentMillis - previousMillis >= LEDtime)) {
//delay(1000);
digitalWrite(ledPinON,LOW);
//previousMillis = currentMillis;
}
if(buttnum == 6){
//Serial.println("button2");
digitalWrite(ledPinOFF, HIGH);
brightenOFF();
darkenOFF();
}
if((buttnum == 6) && (currentMillis - previousMillis >= LEDtime)) {
//delay(1000);
digitalWrite(ledPinOFF,LOW);
previousMillis = currentMillis;
}
}
}
}
void brightenON() {
uint16_t i, j;
for (j = 0; j < 64; j++) {
for (i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, j, 0, 0, 0);
}
strip.show();
delay(15);
}
}
void darkenON() {
Serial.begin(9600);
uint16_t i, j;
for (j = 64; j > 0; j--) {
for (i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, j, 0, 0, 0);
}
strip.show();
delay(15);
Serial.println(j);
}
}
void brightenOFF() {
uint16_t i, j;
for (j = 0; j < 64; j++) {
for (i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 0, j, 0, 0);
}
strip.show();
delay(15);
}
}
void darkenOFF() {
Serial.begin(9600);
uint16_t i, j;
for (j = 64; j > 0; j--) {
for (i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 0, j, 0, 0);
}
strip.show();
delay(15);
Serial.println(j);
}
}
So I suppose in summary, my revised question is: how do I make it so that the LED and neoPixel turn on simultaneously, provided that the LED remain on for 1 second and the neoPixel pulse through a period of 3 seconds?