Advertisement
claudiusmarius

ESP32_MultiplesTM1637_One_Clock_5Display

Dec 10th, 2022
1,329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.13 KB | None | 0 0
  1. //****************************************************************************************************************************************************************************
  2.   // ESP32 et multiples TM1637 avec CLK commune aux 5 afficheurs
  3.   // https://www.youtube.com/c/ClaudeDufourmont
  4.   //****************************************************************************************************************************************************************************
  5.  
  6.   #include <TM1637Display.h>
  7.  
  8.   #define CLK1 16                                                         // CLK1 est utilisée en commun pour les 5 afficheurs
  9.    
  10.   #define DIO1 17
  11.   #define DIO2 18
  12.   #define DIO3 21
  13.   #define DIO4 23
  14.   #define DIO5 33
  15.    
  16.   int MaPression;
  17.   int MaTemperature;
  18.   int MaVitesseDeVent;
  19.   int MaDirectionDeVent;
  20.   int MonHumidite;
  21.  
  22.   TM1637Display display1(CLK1, DIO1);                                    
  23.   TM1637Display display2(CLK1, DIO2);                                    
  24.   TM1637Display display3(CLK1, DIO3);
  25.   TM1637Display display4(CLK1, DIO4);
  26.   TM1637Display display5(CLK1, DIO5);
  27.  
  28.   void setup()
  29.   {
  30.   Serial.begin(115200);
  31.   display1.setBrightness(0x0f);                                          
  32.   display2.setBrightness(0x0f);
  33.   display3.setBrightness(0x0f);
  34.   display4.setBrightness(0x0f);
  35.   display5.setBrightness(0x0f);
  36.   }
  37.  
  38.   void loop()
  39.   {
  40.   MaPression = 1111 ;
  41.   MaVitesseDeVent = 2222;
  42.   MaTemperature = 3333;
  43.   MaDirectionDeVent = 4444;
  44.   MonHumidite = 5555;          
  45.    
  46.   Serial.println( MaPression );
  47.   delay (500);
  48.   Serial.println( MaTemperature );
  49.   delay (500);
  50.   Serial.println( MaVitesseDeVent );
  51.   delay (500);
  52.   Serial.println (MaDirectionDeVent);
  53.  
  54.   display1.clear ();
  55.   display2.clear ();
  56.   display3.clear ();
  57.   display4.clear ();
  58.   display5.clear ();
  59.  
  60.   display1.showNumberDec(MaPression) ;
  61.   delay(10);
  62.  
  63.   display2.showNumberDec(MaVitesseDeVent) ;
  64.   delay(10);
  65.  
  66.   display3.showNumberDec(MaTemperature) ;
  67.   delay(10);
  68.  
  69.   display4.showNumberDec(MaDirectionDeVent) ;
  70.   delay(10);
  71.  
  72.   display5.showNumberDec(MonHumidite) ;
  73.   delay(10);
  74.   }    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement