tweak de full

This commit is contained in:
Julien Cabillot 2017-04-21 11:25:46 +02:00 committed by Cabillot Julien
parent 948edfe2ec
commit 9461523707

View File

@ -11,7 +11,7 @@
// LED
// En déplaçant ces vars dans le .h + init dans le setup, cylon crash au moment du premier retour ?!
int brightness = LED_BRIGHTNESS_DEFAULT;
float brightness = LED_BRIGHTNESS_DEFAULT;
int color = LED_COLOR_DEFAULT;
int speed = LED_SPEED_DEFAULT;
CRGB leds[LED_NUM];
@ -324,14 +324,18 @@ void ledError()
*/
void ledFullColor()
{
// Source : http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/
float breath = (exp(sin(millis() / 2000.0 * map(speed, 0, 255, 50, 300)/100 * PI)) - 0.3678794) * 108.4;
// En dessous de 3 les leds paraissent éteintes
breath = map(breath, 0, 255, 3, brightness);
FastLED.setBrightness(breath);
// Source : http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/
// Voic la version avec la gestion du speed, mais je ne suis pas convaincu
//float breath = (exp(sin(millis() / 2000.0 * map(speed, 0, 255, 50, 300)/100 * PI)) - 0.3678794) * 108.4;
float breath = (exp(sin(millis() / 4000.0 * PI)) - 0.3678794) * 108.4;
// J'ai essayé de mapper breath sur 3;brightness pour ne pas eteindre les leds,
// mais l'effet est plus saccadé
fill_solid(leds, LED_NUM, color);
FastLED.delay(1);
FastLED.setBrightness(breath);
FastLED.show();
}
///////////////////// FastLED-3.1.5/examples/ColorPalette /////////////////////