Paso 10: Led animación - Leds lento al azar
utiliza la función random en arduino a la luz de 8 LED ' s en diferentes colores con este código
void led_Anima_random_slow () {}
''' Temporizador para el próximo led '''/ /
Si (GPcurrenttime - previous_case_seven > = 3000) {}
previous_case_seven = GPcurrenttime;
generación de números aleatorios
random_led = random (8, 31);
random_bright = random(100);
random_led_b = random (8, 31);
random_bright_b = random(100);
random_led_c = random (8, 31);
random_bright_c = random(100);
first_time_fade_blink = 1;
case_seven_styles ++;
Apague todos los
Si (case_seven_styles > = 2) {}
case_seven_styles = 0;
} / / fin si más de
} / / fin si primera vez
interruptor (case_seven_styles) {}
caso 0: / / Gire
Si (first_time_fade_blink == 1) {}
first_time_fade_blink = 0;
para (int i = 8; i < = 31; i ++) {}
ShiftPWM.SetOne (i, 0);
} / / fin todo apagado
sistema LED y colores
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
} //end si primera vez
rotura;
caso 1: / / Gire
Si (first_time_fade_blink == 1) {}
first_time_fade_blink = 0;
para (int i = 8; i < = 31; i ++) {}
ShiftPWM.SetOne (i, 0);
} / / fin todo apagado
sistema LED y colores
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
ShiftPWM.SetOne (random (8, 31), random(100));
} //end si primera vez
rotura;
} / / fin caso de interruptor
} / / fin vacío