It is about 250 - 260 lines long, and since the entirety of the turn on/off functions are included in case 1 & 2, I did not see it necessary to include the entire sketch, I thought that it would become too cluttered.
Below I have included the entire sketch.
#include <stdlib.h>
#include <TFT_eSPI.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
#define RED 255,0,0
#define GREEN 0,128,0
#define BLUE 0,0,255
#define WHITE 255,255,255
#define LED_DT 27
#define COLOR_ORDER GRB
#define LED_TYPE WS2812
#define NUM_LEDS 60
#define TFT_WHITE 0xFFFF /* 255, 255, 255 */
Adafruit_NeoPixel strip(NUM_LEDS, LED_DT, NEO_GRB + NEO_KHZ800);
int i;
int k;
int j;
const int RanCol = random(0, 255);
const int SRanCol = random(0, 255);
const int TRanCol = random(0, 255);
#define r RanCol, SRanCol, TRanCol
TFT_eSPI tft = TFT_eSPI();
const int h = random(100, 1500);
const int sh = random(100, 1500);
int Program;
void MoodLight() {
int locRan = random(0, 255);
int SlocRan = random(0, 25);
int TlocRan = random(0, 255);
#define p locRan, SlocRan, TlocRan
for (int j = 0; j <= 59; j++)
{
strip.setPixelColor(j, p);
strip.show();
}
for (int i = 5; i <= 100; i++)
{
strip.setBrightness(i);
Serial.println(i);
strip.show();
delay(100);
}
delay(1500);
for (int i = 100; i >= 5; i--)
{
strip.setBrightness(i);
Serial.println(i);
strip.show();
delay(100);
}
#undef p
}
void ChristmasLights() {
for (int i = 0; i <= 59; i += 3)
{
Serial.println("i");
strip.setPixelColor(i, RED);
strip.show();
}
for (int k = 1; k <= 59; k += 3)
{
Serial.println("j");
strip.setPixelColor(k, GREEN);
strip.show();
}
for (int j = 2; j <= 59; j += 4)
{
Serial.println("k");
strip.setPixelColor(j, BLUE);
strip.show();
}
delay(h);
for (int i = 1; i <= 59; i += 3)
{
Serial.println("i2");
strip.setPixelColor(i, RED);
strip.show();
}
for (int k = 0; k <= 59; k += 3)
{
Serial.println("k2");
strip.setPixelColor(k, GREEN);
strip.show();
}
for (int j = 2; j <= 59; j += 4)
{
Serial.println("j2");
strip.setPixelColor(j, BLUE);
strip.show();
}
delay(sh);
for (int i = 2; i <= 59; i += 3)
{
Serial.println("i3");
strip.setPixelColor(i, RED);
strip.show();
}
for (int k = 1; k <= 59; k += 3)
{
Serial.println("k3");
strip.setPixelColor(k, GREEN);
strip.show();
}
for (int j = 0; j <= 59; j += 4)
{
Serial.println("j3");
strip.setPixelColor(j, BLUE);
strip.show();
}
}
void taend() {
for (j = 0; j <= 59; j++)
{
strip.setPixelColor(j, WHITE);
strip.show();
}
for (int i = 1; i <= 25; i++)
{
strip.setBrightness(i);
Serial.println(i);
strip.show();
delay(25);
}
for (i = 25; i = 25; i = 25)
{}
}
void Sluk() {
for (j = 0; j <= 59; j++)
{
strip.setPixelColor(j, WHITE);
strip.show();
}
for (int i = 50; i >= 5; i--)
{
strip.setBrightness(i);
Serial.println(i);
strip.show();
delay(100);
}
}
// Taget fra 'Adafruit Strandtest'-eksempel.
void rainbow(int wait) {
// Hue of first pixel runs 5 complete loops through the color wheel.
// Color wheel has a range of 65536 but it's OK if we roll over, so
// just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
// means we'll make 5*65536/256 = 1280 passes through this outer loop:
for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
for (int i = 0; i < strip.numPixels(); i++) { // For each pixel in strip...
// Offset pixel hue by an amount to make one full revolution of the
// color wheel (range of 65536) along the length of the strip
// (strip.numPixels() steps):
int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
// strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
// optionally add saturation and value (brightness) (each 0 to 255).
// Here we're using just the single-argument hue variant. The result
// is passed through strip.gamma32() to provide 'truer' colors
// before assigning to each pixel:
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
}
strip.show(); // Update strip with new contents
delay(25); // Pause for a moment
}
}
void setup() {
Serial.begin(115200);
// LEDS.addLeds <LED_TYPE, LED_DT, COLOR_ORDER> (leds, NUM_LEDS);
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(25);
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
}
void loop() {
if (Serial.available() > 0)
{
Program = Serial.read() - 48;
}
switch (Program)
{
case 0:
Serial.println("Please choose a program");
Serial.println(Program);
break;
case 1:
Serial.println("Program 1");
Serial.println(Program);
for (j = 0; j <= 59; j++)
{
strip.setPixelColor(j, WHITE);
strip.show();
}
for (int i = 1; i <= 25; i++)
{
strip.setBrightness(i);
Serial.println(i);
strip.show();
delay(25);
}
for (i = 25; i = 25; i = 25)
{}
break;
case 2:
Serial.println("Program 2");
Serial.println(Program);
for (j = 0; j <= 59; j++)
{
strip.setPixelColor(j, WHITE);
strip.show();
}
for (int i = 25; i >= 1; i--)
{
strip.setBrightness(i);
Serial.println(i);
strip.show();
delay(100);
}
for (i = 1; i = 1; i = 1)
{}
break;
case 3:
Serial.println("Program 3");
Serial.println(Program);
break;
default:
Serial.println("Please choose a program from 1 - 3");
Serial.println(Program);
}
delay(1500);
}