Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //================================================================================================================================================================
- // Claude DUFOURMONT
- //--------------------------------------------------------- [email protected] ------------------------------------------------------------------------
- // My YouTube : https://www.youtube.com/channel/UCvr9eb05lJow6N7m3SKqvNw
- // DUFOURMONT Le 24/11/2020
- // Le but de ce code Nano :
- // -Aquerir le top demarrage
- // -Aquerir les états de décollage
- // Transmettre les informations aux modules d'animation
- //
- // NANO_detecteur061.ino
- //================================================================================================================================================================
- #define Anneau01Decole 2 // Anneau supérieur Décollé : LED bleue
- #define Anneau02Decole 3 // Deuxième anneau en partant du haut Décollé : LED blanche
- #define Anneau03Decole 4 // Troisième anneau en partant du haut Décollé : LED verte
- #define Anneau04Decole 5 // Quatrième anneau en partant du haut Décollé : LED jaune
- #define BPUPActionne 6 // LED rouge
- #define BPDOWNActionne 6
- #define BPONOFFctionne 8
- #define moteurUP 11
- #define moteurDOWN 12
- #define BrocheBuzzer 7
- #define N_LEDS1 8
- float ValDetecteur01;
- float ValDetecteur02;
- float ValDetecteur03;
- float ValDetecteur04;
- float ValBPUP;
- float ValBPDOWN;
- float ValBPONOFFLED;
- bool etatBPUP;
- bool LastetatBPUP;
- bool etatBPDOWN;
- bool LastetatBPDOWN;
- bool etatBPONOFFLED;
- bool LastetatBPONOFFLED;
- void setup()
- {
- pinMode (Anneau01Decole, OUTPUT);
- pinMode (Anneau02Decole, OUTPUT);
- pinMode (Anneau03Decole, OUTPUT);
- pinMode (Anneau04Decole, OUTPUT);
- pinMode (BPUPActionne, OUTPUT);
- pinMode (BrocheBuzzer, OUTPUT);
- pinMode (11, OUTPUT);
- etatBPUP = LOW;
- LastetatBPUP = LOW;
- }
- void loop ()
- {
- //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Determination des etats DEBUT DEBUT DEBUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPUP DEBUTt++++++++++++++++++++++++++++++++++++++++++++++
- delay(5);
- ValBPUP = analogRead (A0);
- if ( ValBPUP < 900)
- {
- etatBPUP = HIGH;
- LastetatBPUP = HIGH;
- }
- else
- {
- etatBPUP = LOW;
- }
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPUP FIN++++++++++++++++++++++++++++++++++++++++++++++++++
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPDOWN DEBUTt++++++++++++++++++++++++++++++++++++++++++++++
- delay(5);
- ValBPDOWN = analogRead (A5);
- if ( ValBPDOWN < 900)
- {
- etatBPDOWN = HIGH;
- LastetatBPDOWN = HIGH;
- }
- else
- {
- etatBPDOWN = LOW;
- }
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPDOWN FIN++++++++++++++++++++++++++++++++++++++++++++++++++
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPONOFFLED DEBUTt++++++++++++++++++++++++++++++++++++++++++++++
- delay(5);
- ValBPONOFFLED = analogRead (A6);
- if ( ValBPONOFFLED < 900)
- {
- etatBPONOFFLED = HIGH;
- LastetatBPONOFFLED = HIGH;
- }
- else
- {
- etatBPONOFFLED = LOW;
- }
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPONOFFLED FIN++++++++++++++++++++++++++++++++++++++++++++++++++
- //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Determination des etats FIN FIN FIN <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Positionnement des sorties DEBUT DEBUT DEBUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement BPUPActionne DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
- delay(5);
- if (LastetatBPUP ==HIGH)
- {
- digitalWrite (BPUPActionne, HIGH);
- }
- else
- {
- digitalWrite (BPUPActionne, LOW);
- }
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau01Decole DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
- delay(5);
- ValDetecteur01 = analogRead (A1);
- if ( ValDetecteur01 < 600 && LastetatBPUP==HIGH)
- {
- digitalWrite (Anneau01Decole, HIGH);
- }
- else
- {
- digitalWrite (Anneau01Decole, LOW);
- }
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau01Decole FIN FIN FIN+++++++++++++++++++++++++++++++++++++++
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau02Decole DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
- delay(5);
- ValDetecteur02 = analogRead (A2);
- if ( ValDetecteur02 < 600 && LastetatBPUP==HIGH)
- {
- digitalWrite (Anneau02Decole, HIGH);
- }
- else
- {
- digitalWrite (Anneau02Decole, LOW);
- }
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau02Decole FIN FIN FIN+++++++++++++++++++++++++++++++++++++++
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau03Decole DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
- delay(5);
- ValDetecteur03 = analogRead (A3);
- if ( ValDetecteur03 < 600 && LastetatBPUP==HIGH)
- {
- digitalWrite (Anneau03Decole, HIGH);
- }
- else
- {
- digitalWrite (Anneau03Decole, LOW);
- }
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau03Decole FIN FIN FIN+++++++++++++++++++++++++++++++++++++++
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau04Decole DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
- delay(5);
- ValDetecteur04 = analogRead (A4);
- if ( ValDetecteur04 < 600 && LastetatBPUP==HIGH)
- {
- digitalWrite (Anneau04Decole, HIGH);
- }
- else
- {
- digitalWrite (Anneau04Decole, LOW);
- }
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau04Decole FIN FIN FIN+++++++++++++++++++++++++++++++++++++++
- }
Add Comment
Please, Sign In to add comment