First cycle: I want all 16 lights to fade from off to brightest and back to off.
Second cycle: I want all lights bet set to off.
I want first cycle to run a definable amount (twice) with a definable pause in between.
I want second cycle to run with a definable pause in between the first cycle for a definable amount of time.
I want it all to run in a loop.
Would someone please help me out with this? Please feel free to cur teak the code. I'm sure it can be done more robust from someone with skills
Code: Select all
#include <Adafruit_NeoPixel.h>
#define PIN 0 // Trinket Output pin #
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(16, PIN);
uint8_t i,j,n;
uint8_t p = 25; //color decrease increments
uint8_t wait = 3500;
uint32_t BLACK = 0x000000; // black
uint32_t GREEN = 0x00FF00; // green
uint32_t RED = 0xFF0000; // red
void setup() {
pixels.begin();
pixels.show();
}
void heartBeat(){
for(j = 0; j < 250; j=j+p) {
for(i=0; i<16; i++) {
pixels.setPixelColor(i, GREEN);
pixels.show();
//delay(0);
}
}
for(j = 250; j > 0; j=j-p) {
for(i=0; i<16; i++) {
pixels.setPixelColor(i,GREEN);
pixels.show();
//delay(0);
}
}
delay(50);{// time between heartbeats
}
for(j = 0; j < 250; j=j+p) {
for(i=0; i<16; i++) {
pixels.setPixelColor(i, GREEN);
pixels.show();
}
}
for(j = 250; j > 0; j=j-p) {
for(i=0; i<16; i++) {
pixels.setPixelColor(i,GREEN);
pixels.show();
//delay(0);
}
}
}
void darkNess() {
for(i=0; i<16; i++) {
pixels.setPixelColor(i,RED);
pixels.show();
//delay(0);
}
}
void loop() {
heartBeat(); // run colorGlow function every loop
darkNess(); // run darkNess function every loop
delay(wait);
}