Hi,
I'm trying to get a sketch that I found online working, but I can't find the appropriate library to include. It is Interval.h.
I know this is likely an incredibly basic thing, but I am completely new to microcontrollers and programming in general.
Any help would be greatly appreciated.
Thanks,
Chris
/*
* Lighting & Interactivity
* Class 2 : LED_Candles
* Feb 7 2017
*/
#include <Adafruit_NeoPixel.h>
#include "Interval.h"
Interval ledTimer0;
Interval ledTimer1;
Interval ledTimer2;
const int neoPixelPin = 5; // control pin
const int numPixels = 7; // number of pixels
int level = 100; // the white LED color for the whole strip
float difference = 1; // the fading difference in each loop
int brightness = 100;
// set up strip:
Adafruit_NeoPixel strip = Adafruit_NeoPixel(numPixels, neoPixelPin, NEO_GRBW + NEO_KHZ800);
void setup() {
strip.begin(); // initialize pixel strip
strip.clear(); // turn all LEDs off
strip.setBrightness(brightness);
pinMode(neoPixelPin, OUTPUT);
Serial.begin(9600);
ledTimer0.setInterval(fade0, 100);
ledTimer1.setInterval(fade1, 5);
ledTimer2.setInterval(fade2, 500);
for (int pixel = 0; pixel < numPixels; pixel++) {
strip.setPixelColor(pixel, 255, level, level, level); // set the color for all the pixels
strip.show(); // refresh the strip
}
}
void loop() {
// loop pixels:
ledTimer0.check();
ledTimer1.check();
ledTimer2.check();
for (int pixel = 0; pixel < numPixels; pixel++) {
strip.show(); // check all the pixels
}
}
////////////// Set pair 1
void fade0() {
for (int pixel = 0; pixel < 2; pixel++) {
strip.setPixelColor(pixel, 255, 0, 0, level);
}
if ((level >= 255) || (level < 0)) {
level++;
}
level = level - 10;
}
////////////// Set pair 2
void fade1() {
for (int pixel = 2; pixel < 4; pixel++) {
strip.setPixelColor(pixel, 255, 0, 0, level); // set the color for this pixel
}
if (level >= 255) { // if level's at the top
difference++; // invert the difference value
}
level = level + difference; // add the difference to the level
}
////////////// Set pair 3
void fade2() {
for (int pixel = 4; pixel < 6; pixel++) {
strip.setPixelColor(pixel, level + 255, level + 255, level + 255, level); // set the color for this pixel
}
if (level < 0) {
level += difference;
}
difference = -difference; // add the difference to the level
}