|
|
|
@ -239,7 +239,7 @@ void ledCylon() |
|
|
|
*/ |
|
|
|
void ledError() |
|
|
|
{ |
|
|
|
for(int i = 0; i < LED_NUM; i++) { |
|
|
|
for (int i = 0; i < LED_NUM; i++) { |
|
|
|
if ((i % 2) == 0) { |
|
|
|
leds[i] = CRGB::Black; |
|
|
|
} else { |
|
|
|
@ -250,10 +250,15 @@ void ledError() |
|
|
|
FastLED.delay(1000 / speed); |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
* Affiche une couleur de manière uniforme sur le strip. |
|
|
|
* Pour éviter un éclairage basique, on applique un breath qui permet |
|
|
|
* de faire respirer la couleur (brightness). |
|
|
|
*/ |
|
|
|
void ledFullColor() |
|
|
|
{ |
|
|
|
fill_solid(leds, LED_NUM, color); |
|
|
|
// TODO : il fadrait pas faire 0 -> 255 mais plutot 20 -> brightness
|
|
|
|
// 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
|
|
|
|
@ -273,9 +278,8 @@ void ledColorPattern() |
|
|
|
static uint8_t startIndex = 0; |
|
|
|
startIndex = startIndex + 1; /* motion speed */ |
|
|
|
|
|
|
|
FillLEDsFromPaletteColors( startIndex); |
|
|
|
FillLEDsFromPaletteColors(startIndex); |
|
|
|
|
|
|
|
FastLED.show(); |
|
|
|
FastLED.delay(1000 / speed); |
|
|
|
} |
|
|
|
|
|
|
|
@ -284,7 +288,12 @@ void FillLEDsFromPaletteColors(uint8_t colorIndex) |
|
|
|
uint8_t brightness = 255; |
|
|
|
|
|
|
|
for( int i = 0; i < LED_NUM; i++) { |
|
|
|
leds[i] = ColorFromPalette(currentPalette, colorIndex, brightness, currentBlending); |
|
|
|
leds[i] = ColorFromPalette( |
|
|
|
currentPalette, |
|
|
|
colorIndex, |
|
|
|
brightness, |
|
|
|
currentBlending |
|
|
|
); |
|
|
|
colorIndex += 3; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -296,7 +305,6 @@ void FillLEDsFromPaletteColors(uint8_t colorIndex) |
|
|
|
//
|
|
|
|
// Additionally, you can manually define your own color palettes, or you can write
|
|
|
|
// code that creates color palettes on the fly. All are shown here.
|
|
|
|
|
|
|
|
void ChangePalettePeriodically() |
|
|
|
{ |
|
|
|
uint8_t secondHand = (millis() / 1000) % 60; |
|
|
|
@ -345,7 +353,7 @@ void SetupBlackAndWhiteStripedPalette() |
|
|
|
void SetupPurpleAndGreenPalette() |
|
|
|
{ |
|
|
|
CRGB purple = CHSV(HUE_PURPLE, 255, 255); |
|
|
|
CRGB green = CHSV(HUE_GREEN, 255, 255); |
|
|
|
CRGB green = CHSV(HUE_GREEN, 255, 255); |
|
|
|
CRGB black = CRGB::Black; |
|
|
|
|
|
|
|
currentPalette = CRGBPalette16( |
|
|
|
|