Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //================================================================================================================================================================
- // COMMUTATION ANIMATION 16 possibiliés fonction des 4entrées numériques
- // FONCTIONNEMENT actuellement sur matrice 25 LEDS mais nous pouvons commander des strips avec un nombre de LEDS < 110
- // Il s'agit d'une plaquette générique et donc nous avons libre choix de placer pour chaque fonction sélectionnée en fonction des 4 entrées et de la table de
- // vérité le code d'animation souhaité.
- // Plaquette_ATtiny85_generique_Neopixels01
- // DUFOURMONT Le 25/11/2020
- // claude.dufourmont@laposte.net
- // YouTube Channel : https://www.youtube.com/channel/UCvr9eb05lJow6N7m3SKqvNw
- //================================================================================================================================================================
- //====================================================================================
- //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- // 109 LEDs au MAXIMUN >
- //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- //====================================================================================
- #include <Adafruit_NeoPixel.h>
- #define PIN1 0
- #define E1 1
- #define E2 2
- #define E3 3
- #define E4 4
- #define N_LEDS1 109
- bool etatE1 = LOW;
- bool etatE2 = LOW;
- bool etatE3 = LOW;
- bool etatE4 = LOW;
- Adafruit_NeoPixel strip1(N_LEDS1, PIN1, NEO_GRB + NEO_KHZ800);
- void setup()
- {
- //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- // Les pinMode ne sont pas déclarés car sur l'ATtiny85 c'est INPUT d'office >
- //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- strip1.begin();
- strip1.clear();
- strip1.setBrightness(4);
- strip1.show();
- }
- void loop ()
- {
- digitalRead (E1);
- digitalRead (E2);
- digitalRead (E3);
- digitalRead (E4);
- //========================================================================DETERMINATION DES ETATS LOGIQUE -----DEBUT-----===============================================================
- if ( digitalRead (E1) == HIGH)
- {
- etatE1 = HIGH;
- }
- else
- {
- etatE1 = LOW;
- }
- if ( digitalRead (E2) == HIGH)
- {
- etatE2 = HIGH;
- }
- else
- {
- etatE2 = LOW;
- }
- if ( digitalRead (E3) == HIGH)
- {
- etatE3 = HIGH;
- }
- else
- {
- etatE3 = LOW;
- }
- if ( digitalRead (E4) == HIGH)
- {
- etatE4 = HIGH;
- }
- else
- {
- etatE4 = LOW;
- }
- //========================================================================DETERMINATION DES ETATS LOGIQUE -----FIN-----===============================================================
- //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- //========================================================================TABLE DE VERITE -----DEBUT-----==============================================================================
- if (etatE1 == LOW && etatE2 == LOW && etatE3 == LOW && etatE4 == LOW)
- {
- animation00 ();
- }
- if (etatE1 == LOW && etatE2 == LOW && etatE3 == LOW && etatE4 == HIGH)
- {
- animation01 ();
- }
- if (etatE1 == LOW && etatE2 == LOW && etatE3 == HIGH && etatE4 == LOW)
- {
- animation02 ();
- }
- if (etatE1 == LOW && etatE2 == LOW && etatE3 == HIGH && etatE4 == HIGH)
- {
- animation03 ();
- }
- if (etatE1 == LOW && etatE2 == HIGH && etatE3 == LOW && etatE4 == LOW)
- {
- animation04 ();
- }
- if (etatE1 == LOW && etatE2 == HIGH && etatE3 == LOW && etatE4 == HIGH)
- {
- animation05 ();
- }
- if (etatE1 == LOW && etatE2 == HIGH && etatE3 == HIGH && etatE4 == LOW)
- {
- animation06 ();
- }
- if (etatE1 == LOW && etatE2 == HIGH && etatE3 == HIGH && etatE4 == HIGH)
- {
- animation07 ();
- }
- if (etatE1 == HIGH && etatE2 == LOW && etatE3 == LOW && etatE4 == LOW)
- {
- animation08 ();
- }
- if (etatE1 == HIGH && etatE2 == LOW && etatE3 == LOW && etatE4 == HIGH)
- {
- animation09 ();
- }
- if (etatE1 ==HIGH && etatE2 == LOW && etatE3 == HIGH && etatE4 == LOW)
- {
- animation10 ();
- }
- if (etatE1 == HIGH && etatE2 == LOW && etatE3 == HIGH && etatE4 == HIGH)
- {
- animation11 ();
- }
- if (etatE1 == HIGH && etatE2 == HIGH && etatE3 == LOW && etatE4 == LOW)
- {
- animation12 ();
- }
- if (etatE1 == HIGH && etatE2 == HIGH && etatE3 == LOW && etatE4 == HIGH)
- {
- animation13 ();
- }
- if (etatE1 == HIGH && etatE2 == HIGH && etatE3 == HIGH && etatE4 == LOW)
- {
- animation14 ();
- }
- if (etatE1 == HIGH && etatE2 == HIGH && etatE3 == HIGH && etatE4 == HIGH)
- {
- animation15 ();
- }
- }
- void animation00 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(0, 255, 0, 0);
- strip1.show ();
- delay(1000);
- }
- void animation01 ()
- {
- strip1.clear();
- strip1.show();
- delay(1000);
- for ( int i = 0; i<5; i++)
- {
- strip1.setPixelColor(i, 255, 0, 0);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 5; i<10; i++)
- {
- strip1.setPixelColor(i,0, 255, 0);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 10; i<15; i++)
- {
- strip1.setPixelColor(i, 0, 0, 255);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 15; i<20; i++)
- {
- strip1.setPixelColor(i, 100, 40, 255);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 20; i<25; i++)
- {
- strip1.setPixelColor(i, 255, 255, 255);
- strip1.show ();
- }
- delay(1000);
- strip1.clear ();
- strip1.show ();
- delay(1000);
- }
- void animation02 ()
- {
- strip1.clear();
- strip1.show();
- delay(1000);
- for ( int i = 0; i<5; i= i+2)
- {
- strip1.setPixelColor(i, 255, 0, 0);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 5; i<10; i= i+2)
- {
- strip1.setPixelColor(i,0, 255, 0);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 10; i<15; i= i+2)
- {
- strip1.setPixelColor(i, 0, 0, 255);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 15; i<20; i= i+2)
- {
- strip1.setPixelColor(i, 100, 40, 255);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 20; i<25; i= i+2)
- {
- strip1.setPixelColor(i, 255, 255, 255);
- strip1.show ();
- }
- delay(1000);
- strip1.clear ();
- strip1.show ();
- delay(1000);
- }
- void animation03 ()
- {
- strip1.clear();
- strip1.show();
- delay(1000);
- for ( int i = 2; i<23; i= i+5)
- {
- strip1.setPixelColor(i, 255, 0, 0);
- strip1.show ();
- }
- delay(1000);
- for ( int i = 2; i<23; i= i+5)
- {
- strip1.setPixelColor(i,0, 255, 0);
- strip1.show ();
- }
- delay(1000);
- strip1.clear ();
- strip1.show ();
- delay(1000);
- }
- void animation04 ()
- {
- strip1.clear();
- strip1.show();
- delay(1000);
- for ( int i = 10; i<15; i++)
- {
- strip1.setPixelColor(i, 0, 0, 255);
- strip1.show ();
- }
- delay(300);
- for ( int i = 10; i<15; i++)
- {
- strip1.setPixelColor(i,0, 255, 0);
- strip1.show ();
- }
- delay(300);
- strip1.clear ();
- strip1.show ();
- delay(1000);
- }
- void animation05 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(5, 0, 255, 0);
- strip1.show ();
- delay(1000);
- }
- void animation06 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(6, 6,0, 255);
- strip1.show ();
- delay(1000);
- }
- void animation07 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(7, 0, 255, 100);
- strip1.show ();
- delay(1000);
- }
- void animation08 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(8, 255, 255, 0);
- strip1.show ();
- delay(1000);
- }
- void animation09 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(9, 40, 255, 100);
- strip1.show ();
- delay(1000);
- }
- void animation10 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(10, 0, 255, 0);
- strip1.show ();
- delay(1000);
- }
- void animation11 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(11, 255, 255, 0);
- strip1.show ();
- delay(1000);
- }
- void animation12 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(12, 0, 255, 255);
- strip1.show ();
- delay(1000);
- }
- void animation13 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(13, 0, 255, 0);
- strip1.show ();
- delay(1000);
- }
- void animation14 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(14, 100, 255, 100);
- strip1.show ();
- delay(1000);
- }
- void animation15 ()
- {
- strip1.clear();
- strip1.show();
- strip1.setPixelColor(5, 255, 255, 255);
- strip1.show ();
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement