//Show LED Colors void show_white(){ FastLED.addLeds(leds, NUM_LEDS); for(int i=0; i < NUM_LEDS; i = i+1 ) { leds[i] = CRGB::White; } FastLED.show(); //write_log("Light: WHITE"); } //Show LED Colors void show_black(){ FastLED.addLeds(leds, NUM_LEDS); for(int i=0; i < NUM_LEDS; i = i+1 ) { leds[i] = CRGB::Black; } FastLED.show(); //write_log("Light: BLACK"); } //Show LED Colors void show_green(){ FastLED.addLeds(leds, NUM_LEDS); for(int i=0; i < NUM_LEDS; i = i+1 ) { leds[i] = CRGB::Green; } FastLED.show(); write_log("Light: GREEN"); } //Set LED Color to RGB Value void set_color(int r, int g, int b){ FastLED.addLeds(leds, NUM_LEDS); for(int i=0; i < NUM_LEDS; i = i+1 ) { leds[i].setRGB( r, g, b); } FastLED.show(); //write_log("Light: "); //write_log(String(r)); //write_log(String(b)); //write_log(String(g)); } //Run Color movement for Alarm bool run_wake_up(long currentMillis){ if (alarm_started == true) { long delta = (currentMillis - startTime)/1000; long max_wake_time = wakeup_time *60; //Calculate Wakeuptime in Seconds int maxvalue = int(220/(max_wake_time/3)); if (delta < (max_wake_time/3)){ int color_time = delta * maxvalue; set_color(30 + int(color_time), int(color_time)/4, 0); } else if((delta < ((max_wake_time/3)*2))){ int color_time = (delta - (max_wake_time/3)) * maxvalue; set_color(255, int(color_time)+30, int((color_time)/4)); } else if(delta < max_wake_time){ int color_time = (delta - ((max_wake_time/3)*2)) * maxvalue; set_color(255, 255, int((color_time))+30); } else{ if (delta % 2 == 0){ show_white(); } else{ show_black(); } return true; } } else if (lamp_on == true){ } else{ show_black(); } return false; } //Toggle Light Full/Off void switch_lamp(){ if(lamp_on == false){ lamp_on = true; show_white(); } else{ lamp_on = false; show_black(); } } //Start Alarm Light void start_wake_light(long currentMillis){ if (alarm_started == false) { alarm_started = true; startTime = currentMillis; set_color(30, 0, 0); } } //Turn of Alarm Light void stop_wake_light(){ if (alarm_started == true) { alarm_started = false; startTime = 0; show_black(); } }