#include "FastLED.h"
bool On = 0;
bool NightOrDay = 0;
CRGB LED;
bool button0Pressed = false;
bool button1Pressed = false;
bool button2Pressed = false;
bool button3Pressed = false;
bool button4Pressed = false;
byte Br = 10;
void setup() {
pinMode(12, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
}
byte buttonTick(){
byte a = 0;
if (button0Pressed) return 1;
if (button1Pressed) return 2;
if (button2Pressed) return 3;
if (button3Pressed) return 4;
}
void loop() {
// Read the button inputs
button0Pressed = digitalRead(12) == LOW;
button1Pressed = digitalRead(11) == LOW;
button2Pressed = digitalRead(10) == LOW;
button3Pressed = digitalRead(8) == LOW;
if (button0Pressed) {On = !On; delay(500);}
if (button1Pressed) {NightOrDay = !NightOrDay;delay(500);}
if (button2Pressed) Br--;
if (button3Pressed) Br++;
if(On){
if(NightOrDay){analogWrite(9,Br);
digitalWrite(3,0);
digitalWrite(5,0);
digitalWrite(6,0);}
else{LED = ColorFromPalette(HeatColors_p,inoise8(millis()/16));
analogWrite(3,LED.r);
analogWrite(5,LED.g);
analogWrite(6,LED.b);
digitalWrite(9,0);
}
}
else{digitalWrite(3,0);
digitalWrite(5,0);
digitalWrite(6,0);
digitalWrite(9,0);}
}