amélioration de breath
This commit is contained in:
parent
fe64dc5594
commit
948edfe2ec
@ -324,17 +324,14 @@ void ledError()
|
||||
*/
|
||||
void ledFullColor()
|
||||
{
|
||||
fill_solid(leds, LED_NUM, color);
|
||||
// TODO : il fadrait pas faire 0 -> 255 mais plutot 20 (ou plus) -> brightness
|
||||
// Source : http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/
|
||||
// Augmenter 2000 augmente la fréquence (c'est en fait sin((temps / 1000) * Pi/2)
|
||||
// 0.36787944 ?? censé correspondre au minimum
|
||||
// 108.4 ?? censé correspondre au maximum
|
||||
int breath = (exp(sin(millis() / 2000.0 * PI)) - 0.3678794) * 108.4;
|
||||
//Serial.print(breath);
|
||||
//Serial.println(" / 255");
|
||||
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);
|
||||
FastLED.delay(100 / speed);
|
||||
fill_solid(leds, LED_NUM, color);
|
||||
FastLED.delay(1);
|
||||
}
|
||||
|
||||
///////////////////// FastLED-3.1.5/examples/ColorPalette /////////////////////
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user