#include <FastLED.h>
#define NUM_LEDS 16
#define DATA_PIN 2
#define COLOR_ORDER GRB
#define CHIPSET WS2812
#define BRIGHTNESS 255
#define VOLTS 5
#define MAX_AMPS 500
unsigned long com_from_pzlkeep1;
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<CHIPSET,DATA_PIN,COLOR_ORDER>(leds,NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS,MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
Serial.begin(115200); //serial "0" for serial coms to puzzlekeeper 1
//delay and finish set up
delay(100);
Serial.println("PROGRAM START");
}
void loop() {
//serial coms in from puzzlekeeper1
if (Serial.available()) {
com_from_pzlkeep1 = Serial.parseInt();
}
//
staticwhite();
//solve puzzle 1 com_from_pzlkeep1
if(com_from_pzlkeep1 == 11){
breath1yellow();
}
//solve puzzle 2 com_from_pzlkeep1
if(com_from_pzlkeep1 == 12){
breath2green();
}
//solve puzzle 3 com_from_pzlkeep1
if(com_from_pzlkeep1 == 13){
breath3teal();
}
//solve puzzle 4 com_from_pzlkeep1
if(com_from_pzlkeep1 == 14){
breath4blue();
}
//solve puzzle 5 com_from_pzlkeep1
if(com_from_pzlkeep1 == 15){
breath5pink();
}
//solve puzzle 6 com_from_pzlkeep1
if(com_from_pzlkeep1 == 16){
breath6red();
}
//solve puzzle 7 com_from_pzlkeep1
if(com_from_pzlkeep1 == 17){
breath7orange();
}
//solve puzzle 8 com_from_pzlkeep1
if(com_from_pzlkeep1 == 18){
breath8purple();
}
//
}
////////////////////////idle lighting
void staticwhite() {
FastLED.clear();
FastLED.setBrightness(140);
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB::Snow;
}
FastLED.show();
delay(10);
}
////////////////////////puz 1 complete
void breath1yellow() {
FastLED.clear();
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB(249, 237, 0);
}
for (int i=0; i<BRIGHTNESS; i++){ // set brightness to increasing
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
//last set was full bright yellow
for (int i=BRIGHTNESS; i>0; i--){//now decrease brightness
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
}
////////////////////////puz 2 complete
void breath2green() {
FastLED.clear();
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB(29, 202, 23);
}
for (int i=0; i<BRIGHTNESS; i++){ // set brightness to increasing
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
//last set was full bright yellow
for (int i=BRIGHTNESS; i>0; i--){//now decrease brightness
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
}
////////////////////////puz 3 complete
void breath3teal() {
FastLED.clear();
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB(0, 249, 220);
}
for (int i=0; i<BRIGHTNESS; i++){ // set brightness to increasing
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
//last set was full bright yellow
for (int i=BRIGHTNESS; i>0; i--){//now decrease brightness
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
}
////////////////////////puz 4 complete
void breath4blue() {
FastLED.clear();
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB(0, 12, 249);
}
for (int i=0; i<BRIGHTNESS; i++){ // set brightness to increasing
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
//last set was full bright yellow
for (int i=BRIGHTNESS; i>0; i--){//now decrease brightness
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
}
////////////////////////puz 5 complete
void breath5pink() {
FastLED.clear();
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB(232, 0, 249);
}
for (int i=0; i<BRIGHTNESS; i++){ // set brightness to increasing
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
//last set was full bright yellow
for (int i=BRIGHTNESS; i>0; i--){//now decrease brightness
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
}
////////////////////////puz 6 complete
void breath6red() {
FastLED.clear();
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB(249, 0, 0);
}
for (int i=0; i<BRIGHTNESS; i++){ // set brightness to increasing
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
//last set was full bright yellow
for (int i=BRIGHTNESS; i>0; i--){//now decrease brightness
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
}
////////////////////////puz 7 complete
void breath7orange() {
FastLED.clear();
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB(249, 116, 0);
}
for (int i=0; i<BRIGHTNESS; i++){ // set brightness to increasing
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
//last set was full bright yellow
for (int i=BRIGHTNESS; i>0; i--){//now decrease brightness
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
}
////////////////////////puz 8 complete
void breath8purple() {
FastLED.clear();
for (int i=0; i<NUM_LEDS; i++){// set color in whole array
leds[i] = CRGB(100, 0, 249);
}
for (int i=0; i<BRIGHTNESS; i++){ // set brightness to increasing
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
//last set was full bright yellow
for (int i=BRIGHTNESS; i>0; i--){//now decrease brightness
FastLED.setBrightness(i);
FastLED.show();
delay(10);
}
}