#include <FastLED.h>
int lastcase = 9; // number of functions available
// #define NUM_LEDS 160 // 2020 strand
#define NUM_LEDS 49
#define MATRIX_PIN 6 // Uno/Nano (up to 622 WS2812)
// #define MATRIX_PIN 0 // ATtiny88 (only 110 WS2812)
#define MAXBRIGHT 128
CRGB leds[NUM_LEDS];
// int lightningSections[] = { 13, 3, 7, 6, 9, 4, 7 };
int count = 0; // sequence count
#define MINUTES .167 // 10 seconds
// #define MINUTES 10
#define SECONDS 60
unsigned long timer, timeout = MINUTES * SECONDS * 1000UL; // 10 minutes timer
// for zero()
int j, pause = 50, stage = 0, stages = 6; // color stages
int minimum = 0, maximum = 255, increas, decreas; // counters - misspelled to format words
unsigned long fadeTimer, fadeTimeout = 3900; // microseconds = 3.9 milliseconds
#include "func_zero.h"
#include "func_trace.h"
#include "func_marquee2.h"
#include "func_marquee3.h"
#include "func_throb.h"
#include "func_sparkle.h"
#include "func_sparklegap.h"
#include "func_zap.h"
#include "func_zzzt.h"
#include "func_runner.h"
#include "func_rainbowfade.h"
// #include "func_buttonISR.h"
void setup() {
// Serial.begin(115200);
randomSeed(analogRead(A0));
pinMode(LED_BUILTIN, OUTPUT);
FastLED.addLeds<WS2812B, MATRIX_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(MAXBRIGHT); // Adjust the brightness value as needed
FastLED.clear();
FastLED.show();
// configureButtonInterrupt();
}
void loop() {
// readbutton();
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // heartbeat
if (millis() - timer > timeout) {
timer = millis();
count++;
if (count > lastcase)
count = 1;
FastLED.clear();
FastLED.show();
}
// count = 2; // force a function
switch (count) {
case 0: zero(); break; // roygcbm
case 1: trace(); break;
case 2: zap(); break;
case 3: marquee2(); break;
case 4: zzzt(); break;
case 5: throb(); break;
case 6: marquee3(); break;
case 7: sparklegap(); break;
case 8: runner(); break;
case 9: sparkle(); break;
default: break;
}
}
/*
WS2812B - VCC - 1000uF ECAP(+) - Arduino VIN - Power supply (+)
- SIG - 300-500 Ohm resistor - Arduino SIG - x
- GND - 1000uF ECAP(-) - Arduino GND - Power supply (-)
+----------| USB |--------+ +-----+
| D13/SCK MISO/D12 | |E.CAP|
| 3.3V MOSI/D11~| |1k uF|
| Vref SS/D10~| +-----+
| A0 D9~| -| |+ +--------------+
| A1 NANO D8 | +----|-----+---------| VCC |
| A2 D7 | | +--+---------------| GND |
| A3 D6~|--|-|-----|470R Ohm|---| SIG WS2812B |
| A4/SDA D5~| | | +--------------+
| A5/SCL D4 | | |
| A6 INT1/D3~| | | +--------+
| A7 INT0/D2 |--|-|---| BUTTON |
| 5V GND |--|-|---| |=|
| RST RST | | | +--------+
+----| GND 5V DO GND TX1 | | |
| +--| Vin DI SCK RST RX1 | | |
| | +-------------------------+ | | +--------------+
| | | | | POWER SUPPLY |====||= MAINS
| +-------------------------------+-|---| VCC |====||= MAINS
+-----------------------------------+---| GND |
+--------------+
*/