claudiusmarius

Nano Detection Levage

Nov 27th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.46 KB | None | 0 0
  1. //================================================================================================================================================================
  2.   //                                                                Claude DUFOURMONT
  3.   //--------------------------------------------------------- [email protected] ------------------------------------------------------------------------
  4.   //                  My YouTube : https://www.youtube.com/channel/UCvr9eb05lJow6N7m3SKqvNw
  5.   //    DUFOURMONT Le 24/11/2020
  6.   //    Le but de ce code Nano :
  7.   //    -Aquerir le top demarrage
  8.   //    -Aquerir les états de décollage
  9.   //    Transmettre les informations aux modules d'animation
  10.   //
  11.   //   NANO_detecteur061.ino
  12.   //================================================================================================================================================================
  13.  
  14.  
  15.   #define Anneau01Decole      2                                     //  Anneau supérieur Décollé                    : LED bleue
  16.   #define Anneau02Decole      3                                     //  Deuxième anneau en partant du haut Décollé  : LED blanche
  17.   #define Anneau03Decole      4                                     //  Troisième anneau en partant du haut Décollé : LED verte
  18.   #define Anneau04Decole      5                                     //  Quatrième anneau en partant du haut Décollé : LED jaune
  19.  
  20.   #define BPUPActionne        6                                     //  LED rouge
  21.   #define BPDOWNActionne      6
  22.   #define BPONOFFctionne      8
  23.  
  24.   #define moteurUP            11
  25.   #define moteurDOWN          12
  26.  
  27.   #define BrocheBuzzer        7
  28.  
  29.   #define N_LEDS1             8
  30.    
  31.   float ValDetecteur01;
  32.   float ValDetecteur02;
  33.   float ValDetecteur03;
  34.   float ValDetecteur04;
  35.  
  36.   float ValBPUP;
  37.   float ValBPDOWN;
  38.   float ValBPONOFFLED;
  39.                                          
  40.  
  41.   bool etatBPUP;
  42.   bool LastetatBPUP;
  43.  
  44.   bool etatBPDOWN;
  45.   bool LastetatBPDOWN;
  46.  
  47.   bool etatBPONOFFLED;
  48.   bool LastetatBPONOFFLED;
  49.  
  50.  
  51.   void setup()
  52.   {
  53.                                                                            
  54.   pinMode (Anneau01Decole, OUTPUT);
  55.   pinMode (Anneau02Decole, OUTPUT);
  56.   pinMode (Anneau03Decole, OUTPUT);
  57.   pinMode (Anneau04Decole, OUTPUT);
  58.   pinMode (BPUPActionne,   OUTPUT);
  59.   pinMode (BrocheBuzzer,   OUTPUT);
  60.   pinMode (11,             OUTPUT);
  61.  
  62.   etatBPUP = LOW;
  63.   LastetatBPUP = LOW;
  64.  
  65.   }
  66.  
  67.   void loop ()
  68.   {
  69.  
  70.   //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Determination des etats    DEBUT DEBUT DEBUT    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  71.  
  72.   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPUP DEBUTt++++++++++++++++++++++++++++++++++++++++++++++
  73.   delay(5);
  74.   ValBPUP = analogRead (A0);
  75.   if   ( ValBPUP < 900)
  76.   {
  77.   etatBPUP = HIGH;
  78.   LastetatBPUP = HIGH;
  79.   }
  80.   else
  81.   {
  82.   etatBPUP = LOW;
  83.   }
  84.   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPUP FIN++++++++++++++++++++++++++++++++++++++++++++++++++
  85.  
  86.   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPDOWN DEBUTt++++++++++++++++++++++++++++++++++++++++++++++
  87.   delay(5);
  88.   ValBPDOWN = analogRead (A5);
  89.   if   ( ValBPDOWN < 900)
  90.   {
  91.   etatBPDOWN = HIGH;
  92.   LastetatBPDOWN = HIGH;
  93.   }
  94.   else
  95.   {
  96.   etatBPDOWN = LOW;
  97.   }
  98.   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPDOWN FIN++++++++++++++++++++++++++++++++++++++++++++++++++
  99.  
  100.   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPONOFFLED DEBUTt++++++++++++++++++++++++++++++++++++++++++++++
  101.   delay(5);
  102.   ValBPONOFFLED = analogRead (A6);
  103.   if   ( ValBPONOFFLED < 900)
  104.   {
  105.   etatBPONOFFLED = HIGH;
  106.   LastetatBPONOFFLED = HIGH;
  107.   }
  108.   else
  109.   {
  110.   etatBPONOFFLED = LOW;
  111.   }
  112.   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++EtatBPONOFFLED FIN++++++++++++++++++++++++++++++++++++++++++++++++++
  113.  
  114.   //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Determination des etats    FIN FIN FIN    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  115.  
  116.  
  117.   //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Positionnement des sorties    DEBUT DEBUT DEBUT    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  118.  
  119.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement BPUPActionne DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
  120.  
  121.   delay(5);
  122.   if (LastetatBPUP ==HIGH)
  123.    {
  124.  
  125.   digitalWrite (BPUPActionne, HIGH);
  126.  
  127.   }
  128.   else
  129.   {
  130.   digitalWrite (BPUPActionne, LOW);
  131.   }
  132.  
  133.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau01Decole DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
  134.  
  135.   delay(5);
  136.   ValDetecteur01 = analogRead (A1);
  137.   if   ( ValDetecteur01 < 600 && LastetatBPUP==HIGH)
  138.   {
  139.   digitalWrite (Anneau01Decole, HIGH);
  140.   }
  141.   else
  142.   {
  143.   digitalWrite (Anneau01Decole, LOW);
  144.   }
  145.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau01Decole FIN FIN FIN+++++++++++++++++++++++++++++++++++++++
  146.  
  147.  
  148.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau02Decole DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
  149.  
  150.   delay(5);
  151.   ValDetecteur02 = analogRead (A2);
  152.   if   ( ValDetecteur02 < 600 && LastetatBPUP==HIGH)
  153.   {
  154.   digitalWrite (Anneau02Decole, HIGH);
  155.   }
  156.   else
  157.   {
  158.   digitalWrite (Anneau02Decole, LOW);
  159.   }
  160.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau02Decole FIN FIN FIN+++++++++++++++++++++++++++++++++++++++
  161.  
  162.  
  163.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau03Decole DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
  164.  
  165.   delay(5);
  166.   ValDetecteur03 = analogRead (A3);
  167.   if   ( ValDetecteur03 < 600 && LastetatBPUP==HIGH)
  168.   {
  169.   digitalWrite (Anneau03Decole, HIGH);
  170.   }
  171.   else
  172.   {
  173.   digitalWrite (Anneau03Decole, LOW);
  174.   }
  175.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau03Decole FIN FIN FIN+++++++++++++++++++++++++++++++++++++++
  176.  
  177.  
  178.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau04Decole DEBUT DEBUT DEBUT+++++++++++++++++++++++++++++++++++++++
  179.  
  180.   delay(5);
  181.   ValDetecteur04 = analogRead (A4);
  182.   if   ( ValDetecteur04 < 600 && LastetatBPUP==HIGH)
  183.   {
  184.   digitalWrite (Anneau04Decole, HIGH);
  185.   }
  186.   else
  187.   {
  188.   digitalWrite (Anneau04Decole, LOW);
  189.   }
  190.   // +++++++++++++++++++++++++++++++++++++++++++++++++++++++Positionnement Anneau04Decole FIN FIN FIN+++++++++++++++++++++++++++++++++++++++
  191.  
  192.   }
  193.  
Add Comment
Please, Sign In to add comment