Advertisement
claudiusmarius

Test_SeuiltensionPB2

Jun 8th, 2020
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.85 KB | None | 0 0
  1. // ####################################################################################################################################################################################
  2. //                                                                 CLAUDE DUFOURMONT Test_TensionPB2
  3. // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°     claude.dufourmont@laposte.net    °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
  4. // ####################################################################################################################################################################################
  5. //                                                                        Créé le 08/06/20
  6. //                                                    Pour ATtiny85 - Test surveillance tension avec tension sur PB2
  7. //                                                          Ce programme n'a pas de boucle loop , C'EST VOULU
  8. //                                        La LedRouge s'allume ou s'eteint de manière aléatoire comme si PB2 était "en l'air"
  9. //                                            L'essai a été fait avec 2 ATtiny85 différents et avec le même mauvais résultat
  10. // #####################################################################################################################################################################################
  11.  
  12.   #define LedRouge  1                                    
  13.   boolean etatBATBAS;
  14.   int Tension;
  15.   int SeuilTension = 511;
  16.  
  17.   void setup()
  18.   {
  19.   Tension = analogRead (2);                                               // Lecture en 0 - 1023 points de l'image de la tension
  20.   pinMode (LedRouge, OUTPUT);
  21.    
  22.   delay(100);
  23.   analogRead (Tension);  
  24.   if (Tension < SeuilTension)
  25.   {
  26.   etatBATBAS = LOW;                                                       // VOLONTAIREMENT ETAT LOW POUR CE CAS
  27.   }
  28.  
  29.   else
  30.   {
  31.   etatBATBAS = HIGH;
  32.   }
  33.  
  34.   if (etatBATBAS == LOW)
  35.   {
  36.   digitalWrite (LedRouge, HIGH);
  37.   }
  38.  
  39.   if (etatBATBAS == HIGH)
  40.   {
  41.   digitalWrite (LedRouge, LOW);
  42.   }
  43.  
  44.  
  45.   }                                                                     // Accolade de fermeture void setup
  46.  
  47.   void loop () {}
  48.   //***************************************************************************************************************************************************************************************
  49.   //                                                                                  VOLONTAIREMENT PAS DE BOUCLE  
  50.   //***************************************************************************************************************************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement