Advertisement
claudiusmarius

ESP32_MultiplesTM1637_5Couples_CLKDIO

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