From 48311617f13f53536dd66f9953636142d111e95c Mon Sep 17 00:00:00 2001 From: jblb Date: Tue, 7 Dec 2021 17:17:38 +0100 Subject: [PATCH] nouvelles annimations --- src/CycloTiny85.ino | 51 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/src/CycloTiny85.ino b/src/CycloTiny85.ino index e265429..01b5572 100644 --- a/src/CycloTiny85.ino +++ b/src/CycloTiny85.ino @@ -10,10 +10,10 @@ #define BTN_PIN 3 // button pin CRGB leds[NUM_LEDS]; -float tcount = 0.0; //-INC VAR FOR SIN LOOPS +float tcount = 0.0; //-INC VAR FOR SIN LOOPS int ibright = 0; //-BRIGHTNESS (0-255) int tempo_anim = TEMPO; -uint8_t gHue = 0; // rotating "base color" +uint8_t gHue = 0; // rotating "base color" boolean run_mod = false; // run mode Button button1(BTN_PIN, PULLUP, 3000); @@ -66,13 +66,13 @@ void xmas(uint8_t wait){ delay(wait); } } -// change run_mod retur true si appuis cour +// change run_mod return true si appuis cour boolean check_button(){ if (button1.checkPress() == 1) { // SHORT PRESS! if (!run_mod){ run_mod = true; - } + } return true; } else if (button1.checkPress() == -1) { // LONG PRESS! @@ -91,13 +91,31 @@ void setup() } void loop() +// put your main code here, to run repeatedly: { + boolean breaked =false; if (run_mod){ - // put your main code here, to run repeatedly: for (int i = 0; i < 5; i++) { - colorWipe_up(CRGB::Red, tempo_anim); + for (int i = 0; i < NUM_LEDS; i++) { + leds[i] = CRGB::Red; + FastSPI_LED.show(); + delay(tempo_anim); + if (check_button()) { + breaked =true; + break; + } + } delay(tempo_anim); - colorWipe_up(CRGB::Green, tempo_anim); + for (int i = 0; i < NUM_LEDS; i++) { + leds[i] = CRGB::Green; + FastSPI_LED.show(); + delay(tempo_anim); + if (check_button()){ + breaked =true; + break; + } + + } delay(tempo_anim); if (breaked) break; if (check_button()) break; @@ -113,11 +131,24 @@ if (run_mod){ for (int i = 0; i < 20; i++) { xmas( tempo_anim); if (check_button()) break; - } + } +} +if (run_mod){ + int i =1; + int j= 0; + black_out(); + for (int k = 0; k < NUM_LEDS*10 ; k++) { + leds[j] = CRGB::Red; + FastSPI_LED.show(); + delay(tempo_anim/2); + leds[j] = CRGB::Black; + j= j+i; + if(j==NUM_LEDS- 1|| j==0) i= -i; + + if (check_button()) break; + } } check_button(); black_out(); // delay(tempo_anim); } - -