|
|
|
|
@ -57,22 +57,25 @@ void dual_color(struct CRGB color1, struct CRGB color2, uint8_t wait)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void xmas(uint8_t wait){
|
|
|
|
|
for (int j = 0; j < 2; j++){
|
|
|
|
|
for (int i = 0; i< NUM_LEDS; i++){
|
|
|
|
|
leds[i] = ((i % 2) == j)? CRGB::Red: CRGB::Green;
|
|
|
|
|
void xmas(uint8_t wait)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
for (int i = 0; i < NUM_LEDS; i++) {
|
|
|
|
|
leds[i] = ((i % 2) == j) ? CRGB::Red : CRGB::Green;
|
|
|
|
|
FastSPI_LED.show();
|
|
|
|
|
}
|
|
|
|
|
delay(wait);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// change run_mod return true si appuis cour
|
|
|
|
|
boolean check_button(){
|
|
|
|
|
boolean check_button()
|
|
|
|
|
{
|
|
|
|
|
if (button1.checkPress() == 1) {
|
|
|
|
|
// SHORT PRESS!
|
|
|
|
|
if (!run_mod){
|
|
|
|
|
// SHORT PRESS!
|
|
|
|
|
if (!run_mod) {
|
|
|
|
|
run_mod = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
} else if (button1.checkPress() == -1) {
|
|
|
|
|
// LONG PRESS!
|
|
|
|
|
@ -93,68 +96,85 @@ void setup()
|
|
|
|
|
void loop()
|
|
|
|
|
// put your main code here, to run repeatedly:
|
|
|
|
|
{
|
|
|
|
|
boolean breaked =false;
|
|
|
|
|
if (run_mod){
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
|
for (int i = 0; i < NUM_LEDS; i++) {
|
|
|
|
|
leds[i] = CRGB::Red;
|
|
|
|
|
FastSPI_LED.show();
|
|
|
|
|
delay(tempo_anim);
|
|
|
|
|
if (check_button()) {
|
|
|
|
|
breaked =true;
|
|
|
|
|
boolean breaked = false;
|
|
|
|
|
if (run_mod) {
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
|
for (int i = 0; i < NUM_LEDS; i++) {
|
|
|
|
|
leds[i] = CRGB::Red;
|
|
|
|
|
FastSPI_LED.show();
|
|
|
|
|
delay(tempo_anim);
|
|
|
|
|
if (check_button()) {
|
|
|
|
|
breaked = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (breaked || check_button()) {
|
|
|
|
|
memset(leds, 0, NUM_LEDS * 3); // all leds off
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (breaked) break;
|
|
|
|
|
if (check_button()) break;
|
|
|
|
|
delay(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;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
delay(tempo_anim);
|
|
|
|
|
if (breaked) break;
|
|
|
|
|
if (check_button()) break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
breaked = false;
|
|
|
|
|
// dual color
|
|
|
|
|
if (run_mod) {
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
|
dual_color(CRGB::Red, CRGB::Green, tempo_anim);
|
|
|
|
|
if (check_button()) break;
|
|
|
|
|
if (run_mod) {
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
|
for (int i = 0; i < NUM_LEDS; i++) {
|
|
|
|
|
memset(leds, 0, NUM_LEDS * 3); // all leds off
|
|
|
|
|
leds[i] = CRGB::Red;
|
|
|
|
|
leds[NUM_LEDS - (i + 1)] = CRGB::Green;
|
|
|
|
|
FastSPI_LED.show();
|
|
|
|
|
delay(tempo_anim);
|
|
|
|
|
if (check_button()) {
|
|
|
|
|
breaked = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (breaked)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Xmas
|
|
|
|
|
if (run_mod){
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
xmas( tempo_anim);
|
|
|
|
|
if (check_button()) break;
|
|
|
|
|
if (run_mod) {
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
xmas(tempo_anim);
|
|
|
|
|
if (check_button())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// aller-retour
|
|
|
|
|
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 (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;
|
|
|
|
|
if (check_button())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
check_button();
|
|
|
|
|
black_out();
|
|
|
|
|
// delay(tempo_anim);
|
|
|
|
|
|