#define VERSION "20 avril 2022" // change Your_SSIDand IP adress and Wep Key! // Hardware raccordements // ESP ......BMP085 ....OLED Display .........AM2302-Humidity ....Temp sensor // +3V------- 1 VCC ------ 2 OLED SSD1306----1 Humidity Vcc---------1 LM35DZ Vcc // Gnd ------ 2 Gnd -------1 OLED SSD1306 ----4 Humidity Gnd---------3 LM35DZ Gnd // --------------------------------------------------------------3 EOC //-------------------------------------------------------------- 4 XCLCK // D1----------5 SCL -------- 3 OLED SSD1306 // D2----------6 SDA -------- 4 OLED SSD1306 // D5 <------------------------------------------------------ 2 Humidity Data // A0 <-----------------------------------------------------------------------------------------2 LM35DZ outp // D4 --------1K--------------> Led Bleue------------------------Gnd // D6 --------1K--------------> Led Verte------------------------Gnd // D8 --------1k-------------> Led Rouge------------------------Gnd // D7 <----------------------------------------------BP1----750----Gnd // version 18 Avril 20221 // probleme radiobutton selection..rajout rafraichissement checked ..OK // version 17 Avril 20221 // pb generation consigne ????? // rappel test sur carte VEMOS LOLIN (Vert) 2x15 pins NodeMCU V3 // version 14 juil 2021 // choix de carte : LOLIN (VEMOS) D1 mini Pro #include "Arduino.h" // version 1.8.15 #include #include #include #include #include #include #include #include #define SCL 5 // Lolin D1 fil jaune --> SCL BMP085 #define SDA 4 // Lolin D2 fil vert ---> SDA BMP085 #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) #define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); #define LOGO_HEIGHT 16 #define LOGO_WIDTH 16 #define paulfjujo_WIDTH 128 #define paulfjujo_HEIGHT 32 static const unsigned char PROGMEM logo_bmp[] = { 0b00000000, 0b11000000, 0b00000001, 0b11000000, 0b00000001, 0b11000000, 0b00000011, 0b11100000, 0b11110011, 0b11100000, 0b11111110, 0b11111000, 0b01111110, 0b11111111, 0b00110011, 0b10011111, 0b00011111, 0b11111100, 0b00001101, 0b01110000, 0b00011011, 0b10100000, 0b00111111, 0b11100000, 0b00111111, 0b11110000, 0b01111100, 0b11110000, 0b01110000, 0b01110000, 0b00000000, 0b00110000 }; // blanc sur fond noir // http://javl.github.io/image2cpp/ // avec fichier choisi C:\_MikroC\_MesProjets_MikroC\__common\paulfjujo_1bit_128x32.bmp const unsigned char PROGMEM paulfjujo[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1f, 0xff, 0xc1, 0xe0, 0x00, 0x00, 0x78, 0x00, 0x00, 0x07, 0xff, 0x80, 0x00, 0x00, 0x00, 0x1e, 0x1f, 0xff, 0x81, 0xe0, 0x00, 0x00, 0x78, 0x00, 0x00, 0x07, 0xff, 0x80, 0x00, 0x00, 0x00, 0x1e, 0x1f, 0xff, 0x81, 0xe0, 0x00, 0x00, 0x78, 0x00, 0x00, 0x07, 0x87, 0xc0, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x78, 0x00, 0x00, 0x07, 0x83, 0xc0, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x83, 0xc0, 0x7c, 0x00, 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1f, 0xc0, 0x07, 0x83, 0xc0, 0x7c, 0x00, 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1f, 0xc0, 0x07, 0x87, 0xc1, 0xff, 0x87, 0x87, 0x9e, 0x1f, 0xfe, 0x01, 0xe1, 0xe1, 0xe0, 0x78, 0x3f, 0xe0, 0x07, 0xff, 0x83, 0xff, 0x87, 0x87, 0x9e, 0x1f, 0xff, 0x81, 0xe1, 0xe1, 0xe0, 0x78, 0x7f, 0xe0, 0x07, 0xfe, 0x03, 0xc7, 0x87, 0x87, 0x9e, 0x1f, 0xfe, 0x01, 0xe1, 0xe1, 0xe0, 0x78, 0x79, 0xf8, 0x07, 0xfe, 0x03, 0xc7, 0x87, 0x87, 0x9e, 0x1f, 0xfe, 0x01, 0xe1, 0xe1, 0xe0, 0x78, 0x79, 0xf8, 0x07, 0xfc, 0x07, 0x87, 0x87, 0x87, 0x9e, 0x1e, 0x00, 0x01, 0xe1, 0xe1, 0xe0, 0x79, 0xe0, 0x78, 0x07, 0x80, 0x07, 0x87, 0x87, 0x87, 0x9e, 0x1e, 0x00, 0x01, 0xe1, 0xe1, 0xe0, 0x79, 0xe0, 0x78, 0x07, 0x80, 0x07, 0x87, 0x87, 0x87, 0x9e, 0x1e, 0x00, 0x01, 0xe1, 0xe1, 0xe0, 0x79, 0xe0, 0x78, 0x07, 0x80, 0x07, 0x87, 0x87, 0x87, 0x9e, 0x1e, 0x00, 0x01, 0xe1, 0xe1, 0xe0, 0x79, 0xe0, 0x78, 0x07, 0x80, 0x07, 0x87, 0x87, 0x87, 0x9e, 0x1e, 0x00, 0x00, 0x79, 0xe1, 0xe0, 0x3d, 0xe0, 0x78, 0x07, 0x80, 0x07, 0x87, 0x87, 0x87, 0x9e, 0x1e, 0x00, 0x00, 0x79, 0xe1, 0xe0, 0x3d, 0xf9, 0xf8, 0x07, 0x80, 0x03, 0xff, 0xc7, 0xff, 0x9e, 0x1e, 0x00, 0x00, 0x79, 0xff, 0xe0, 0x3c, 0x7f, 0xe0, 0x07, 0x80, 0x03, 0xff, 0xc7, 0xff, 0x9e, 0x1e, 0x00, 0x00, 0x79, 0xff, 0xe0, 0x3c, 0x7f, 0xe0, 0x07, 0x80, 0x03, 0xff, 0xc3, 0xff, 0x9e, 0x1e, 0x00, 0x00, 0x78, 0x7f, 0xe0, 0x3c, 0x7f, 0xc0, 0x02, 0x00, 0x01, 0xf9, 0xc1, 0xff, 0x84, 0x04, 0x00, 0x38, 0x78, 0x3f, 0xfc, 0x3c, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x78, 0x00, 0x1e, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x78, 0x00, 0x1e, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x78, 0x00, 0x1f, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x07, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x01, 0xe0, 0x00, 0x00 }; // Création des objets / create Objects DHTesp dht; #define DHTTYPE DHT22 ; // DHT type (DHT11, DHT22) int DHTPIN = 14 ; //Lolin Pin D5 = GPIO14 <-- Broche du capteur AM2302 #define LED_Bleue 2 //Lolin D4 = LED at GPIO 2 -- led bleue (pull Up) interne au module Lolin #define LED_Verte 12 //Lolin D6 = LED at GPIO 12 --> led verte (pull Down) externe au module Lolin #define LED_Rouge 15 //Lolin D8 = LED at GPIO 15 --> led Rouge (pull Down) externe au module Lolin #define BP1 13 //Lolin D7 = BP at GPIO 13 <-- BP tire au Gnd const char* ssid ="YourSSID"; const char* password = "cxYour Wep Keyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxv4"; int i,j,k; char Tempchar [10]; char Presschar [10]; char Humidchar [10]; char Ana0char[10]; char Oled_Msg[20]; // up to 18 char en taille 1 char BMPOK=0; unsigned int Compteur=0; unsigned int ConsigneV=64; unsigned int Consigne=32; float t = 0.0 ; float h = 0.0 ; float p = 0.0; float LM35=0.0; //int analogPin=A0; // 17-04-2022 int ValADC=0; int SommeValADC=0; float LM35DZ_temp=0.0; float LM35DZ_MAE= 0.040283; // 330.0°C pour 8192 points; String etatLed_B = "OFF"; String etatLed_V = "OFF"; String BP1_status = "OFF"; String Consignechar = "00000"; byte nDevices = 0; byte error=0; byte address=0; uint8_t portArray[] = {16, 5, 4, 0, 2, 14, 12, 13, 15 }; String pinMap[] = {"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8"}; String portMap[] = {"GPIO16","GPIO5","GPIO4","GPIO0","GPIO2","GPIO14","GPIO12","GPIO13","GPIO15"}; IPAddress local_IP(192, 168, 0, 110); // Set your Gateway IP address IPAddress gateway(192, 168, 0, 254); IPAddress subnet(255, 255, 0, 0); IPAddress primaryDNS(212,27,40,241); //optional IPAddress secondaryDNS(212,27,40,240); //optional Adafruit_BMP085 bmp; ESP8266WebServer server (80 ); String getJavas() { String Javas = ""; return Javas; }; String getStyles() { String Styles =" html {font-family: Arial; display: inline-block; text-align: center;}"; Styles+=" h2 {font-size: 2.0rem;} h3 {font-size: 1.75rem;} h4 {font-size: 1.25rem;} h5 {font-size: 0.5rem;}"; Styles+=" p {font-size: 3.0rem;}"; Styles+=" body {max-width: 300px; margin:20px; padding-bottom: 25;}"; Styles+=" .switch {position: relative; display: inline-block; width: 120px; height: 68px} "; Styles+=" .switch input {display: none}"; Styles+=" .slider {position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; border-radius: 6px}"; Styles+=" .slider:before {position: absolute; content: ""; height: 52px; width: 52px;"; Styles+="left: 8px; bottom: 8px; background-color: #fff; -webkit-transition: 1.4s; transition: 1.4s; border-radius: 6px}"; Styles+=" input:checked+.slider {background-color: #0F0}"; Styles+=" input:checked+.slider:before {-webkit-transform: translateX(52px); -ms-transform: translateX(52px); transform: translateX(52px)}"; Styles+=" .switch1 {position: relative; display: inline-block; width: 120px; height: 68px} "; Styles+=" .switch1 input {display: none}"; Styles+=" .slider1 {position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; border-radius: 6px}"; Styles+=" .slider1:before {position: absolute; content: ""; height: 52px; width: 52px;"; Styles+="left: 8px; bottom: 8px; background-color: #fff; -webkit-transition: 1.4s; transition: 1.4s; border-radius: 6px}"; Styles+="input:checked+.slider1 {background-color: #b30000}"; Styles+="input:checked+.slider1:before {-webkit-transform: translateX(52px); -ms-transform: translateX(52px); transform: translateX(52px)}"; Styles+=".switch2 {position: relative; display: inline-block; width: 120px; height: 68px} "; Styles+=".switch2 input {display: none}"; Styles+=".slider2 {position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; border-radius: 6px}"; Styles+=".slider2:before {position: absolute; content: ""; height: 52px; width: 52px;"; Styles+="left: 8px; bottom: 8px; background-color: #fff; -webkit-transition: 1.4s; transition: 1.4s; border-radius: 6px}"; Styles+="input:checked+.slider2 {background-color: #00F}"; Styles+="input:checked+.slider2:before {-webkit-transform: translateX(52px); -ms-transform: translateX(52px); transform: translateX(52px)}"; Styles+=" "; return Styles ; }; String getPage(){ String page = " "; page += "ESP8266MOD Lolin Vert - rev 2022-0420"; // page += ""; getStyles(); page += "

rev 16-07-2021
3_boutons_smooth_slider.html

"; page += "

Led Verte GPIO 15

"; page += ""; page += "

Led Rouge GPIO 12

"; page += "

Led_Bleue GPIO 02

"; page += "
"; page +="
input:checked+.slider {background-color: #b30000} rouge
"; page +="input:checked+.slider {background-color: #00F } Bleu
"; page +="input:checked+.slider {background-color: #0F0 } vert
"; page +="input:checked+.slider {background-color: #F00 } rouge
"; page +=""; page += getJavas(); page += ""; page += "

ESP8266 Lolin Vert

"; page += "

version 19-04-2022

"; page += "

Display mini OLED SSD1306 4 lignes

"; page += "

Capteur DHT11-AM2302

"; page += "
  • Temperature : "; page += t; page += "°C
  • "; page += "
  • Humidite : "; page += h; page += "%
"; page += "

I2C BMP085

"; page += "
  • Pression atmospherique : "; page += p; page += " mbar
"; page += "

Autres données

"; //----------- page += "
  • LM35ZD temper : "; page += LM35DZ_temp; page += "°C
"; //----------- page += "
  • Compteur: "; page += Compteur; page += "
"; //----------- page += "
  • Etat BP1 :  "; page += BP1_status; page += "
"; /* page += "

Sorties GPIO

"; page += "
"; page += "
  • Etat Led Bleue ("; page += etatLed_B; page += ")
    "; if (etatLed_B=="ON") { page += "
    ON   "; page += "
    OFF
"; } else { page += "
ON   "; page += "
OFF"; } page += "
  • Etat Led Verte ("; page += etatLed_V; page += ")
    "; if (etatLed_V=="ON") { page += "
    ON "; page += "
    OFF
"; } else { page += "
ON "; page += "
OFF"; } */ //------------------------------- // page += "

"; //---------------------------------- page += "

Consigne Vitesse

"; page += "

ConsigneV= 0

"; page += "

"; page += "  "; page += "

"; // page += "
"; //------------------------------- page += " "; // page += "
"; //---------------------------------- page += "
"; page += "

paulfjujo


"; page += ""; page += ""; return page; } void handleRoot(){ // bool hasArg(const String& name) const; // check if argument exists if ( ( server.hasArg("LED_B")) or (server.hasArg("LED_V")) or (server.hasArg("ConsigneID")) ) { handleSubmit(); } else { server.send ( 200, "text/html", getPage() ); } Compteur ++; } void handleSubmit() { // Actualise le GPIO / Update GPIO String LEDValue; if ( server.hasArg("LED_B")) { LEDValue = server.arg("LED_B"); Serial.print("Led Bleue : "); Serial.println(LEDValue); if ( LEDValue == "1" ) { digitalWrite(LED_Bleue, HIGH); etatLed_B = "ON"; } else { if ( LEDValue == "0" ) { digitalWrite(LED_Bleue, LOW); etatLed_B = "OFF"; } } } if( server.hasArg("LED_V") ) { LEDValue = server.arg("LED_V"); Serial.print("Led Verte : "); Serial.println(LEDValue); if ( LEDValue == "1" ) { digitalWrite(LED_Verte, HIGH); etatLed_V = "ON"; } else { if ( LEDValue == "0" ) { digitalWrite(LED_Verte, LOW); etatLed_V = "OFF"; } } } if ( server.hasArg("ConsigneID") ) { Serial.println(Consigne); Consignechar= server.arg("Consigne"); Serial.println(Consignechar); } server.send ( 200, "text/html", getPage() ); } void check_if_exist_I2C() { nDevices = 0; for (address = 1; address < 127; address++ ) { // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { Serial.print("\r\nI2C device found at address 0x"); if (address < 16) Serial.print("0"); Serial.print(address, HEX); //Serial.println(" !"); nDevices++; } else if (error == 4) { Serial.print("\r\nUnknow error at address 0x"); if (address < 16) Serial.print("0"); Serial.println(address, HEX); } delay(10); } //for loop if (nDevices == 0) Serial.println("No I2C devices found"); else Serial.printf("\r\n Trouve %3d devices sur le Bus I2C\r\n",nDevices); delay(100); // wait 1 seconds for next scan, did not find it necessary } void setup() { Serial.begin ( 115200 ); Serial.println("\r\n"); pinMode(A0, INPUT); //ANALOG INPUT //analogReference(DEFAULT); // ERROR undefined reference to `analogReference' //error: ld returned 1 exit status pinMode(BP1,INPUT_PULLUP); pinMode(LED_Bleue, OUTPUT); // pull up vers VCC pinMode(LED_Verte, OUTPUT); // pull Down vers Gnd pinMode(LED_Rouge, OUTPUT); // pull Down vers Gnd digitalWrite(LED_Verte, LOW); digitalWrite(LED_Bleue, LOW); digitalWrite(LED_Rouge, LOW); Serial.println(" Test 3 leds "); for (i=0;i<4;i++) { digitalWrite(LED_Bleue,HIGH); digitalWrite(LED_Rouge,LOW); digitalWrite(LED_Verte,HIGH); delay(600); digitalWrite(LED_Bleue,LOW); digitalWrite(LED_Rouge,HIGH); digitalWrite(LED_Verte,LOW); delay(600); } digitalWrite(LED_Bleue,LOW); // eteinte digitalWrite(LED_Verte,LOW); digitalWrite(LED_Rouge,LOW); Serial.println(); Serial.println(" Test AsyncWebserver avec ESP8266 LOLIN (Vert) NodeMCU V3 "); Serial.println(" version :"VERSION); Serial.println(" Analog Temper. sensor LM35DZ"); Serial.println(" Humidity ,Temper numerical sensor DHT11"); Serial.println(" Pressure I2C Sensor BMP085 & I2C mini OLED SSD1306 128x32"); Serial.println(); Serial.println(" Relation Pins LOLIN <---> GPIO"); for (i=0;i<9;i++) { //Serial.printf (" Port % 3d Lolin pin %s Arduino %s\r\n",portArray[i],pinMap[i],portMap[i]); // Serial.printf (" Port "); Serial.print(portArray[i]); Serial.printf (" Port %3d ",portArray[i]); Serial.print(" ESP8266 Lolin pin "); Serial.print(pinMap[i]); Serial.print(" Arduino pin "); Serial.print(portMap[i]); Serial.println(); } Serial.println(); Serial.println(" I2C Bus sur GPIO 4 (SDA) Lolin pin D2 et sur GPIO 5 (SCL) Lolin pin D1"); delay (500); Serial.println(" I2C Scanner to scan for devices on each port pair D0 to D7"); delay(2000); Wire.begin(4,5); // pin on ESP8266 Lolin NodeMCU V3 Vert check_if_exist_I2C(); Serial.println("\r\n .. Fin de test I2C bus \r\n"); // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever } else Serial.println(F("SSD1306 allocation OK")); display.clearDisplay(); // Clear the buffer Serial.println(" Bitmap paulfjujo 1 bit 128x32 "); display.drawBitmap( (display.width() - paulfjujo_WIDTH ) / 2, (display.height() - paulfjujo_HEIGHT) / 2, paulfjujo, paulfjujo_WIDTH, paulfjujo_HEIGHT, 1); display.display(); delay(2000); display.clearDisplay(); // Clear the buffer // BP1 pulled up ! if (digitalRead(BP1)==HIGH) BP1_status="OFF"; else BP1_status="ON"; // Serial.printf("Etat BP1 Lolin D7= GPIO13=%s",BP1_status); Serial.print("Etat BP1 Lolin D7= GPIO13= "); Serial.print(BP1_status); Serial.println(); //-- dht.setup(DHTPIN,DHTesp::DHT22); // Initialisation du BMP180 / Init BMP180 if ( !bmp.begin() ) { Serial.println("BMP180 BAD!"); delay(2000); BMPOK=0; } else { Serial.println("BMP180 OK"); BMPOK=1; } display.clearDisplay(); display.setTextSize(1); // Normal 1:1 pixel scale display.setTextColor(SSD1306_WHITE); // Draw white text display.setCursor(0,0); // Start at top-left corner // Configures static IP address if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) { Serial.println("STA Failed to configure"); } WiFi.begin ( ssid, password ); // Attente de la connexion au réseau WiFi / Wait for connection while ( WiFi.status() != WL_CONNECTED ) { delay ( 500 ); Serial.print ( "." ); } // Connexion WiFi établie / WiFi connexion is OK Serial.println ( "" ); // Serial.println (__VERSION__); Serial.print ( "Connected to " ); Serial.println ( ssid ); Serial.print ( "IP address: " ); Serial.println ( WiFi.localIP() ); display.setTextSize(1); // Normal 1:1 pixel scale display.setTextColor(SSD1306_WHITE); // Draw white text display.setCursor(0,0); // Start at top-left corner display.print(F("IP Adresse ")); display.setCursor(0,8); // Start at top-left corner display.print( WiFi.localIP()); display.display(); delay(1000); // Serial.println("\r\nJavas :"); //Serial.println( getJavas()); Serial.println(); // On branche la fonction qui gère la premiere page / link to the function that manage launch page server.on ( "/", handleRoot ); server.begin(); Serial.println ( "HTTP server started" ); i=0; ConsigneV=64; Consigne=62; Compteur=0; SommeValADC=0; LM35DZ_MAE= 0.040283; // = 330/8192 } void loop() { Serial.printf(" Compteur= %05d Consigne=%05d ",Compteur,Consigne); display.clearDisplay(); server.handleClient(); ValADC =analogRead(A0); // read the input pin A0 on Lolin SommeValADC = SommeValADC + ValADC; Serial.printf(" SommeValADC = %5d ",SommeValADC); i = i + 1; if (i > 7) { LM35= SommeValADC ; LM35DZ_temp =LM35 * LM35DZ_MAE ; // MAE lottant initialisé avec 0.0402832;‬ Serial.printf("LM35DZ = %5.2f%cC ",LM35DZ_temp,'°'); SommeValADC = 0; snprintf( Oled_Msg,6,"%5.2f",LM35DZ_temp); display.setCursor(0,0); display.print(F("A0 LM35DZ ")); display.setCursor(70,0); display.print( Oled_Msg); i=0; } else { Serial.print(" Ana0="); Serial.print(ValADC); Serial.print(" "); display.setCursor(0,0); display.print(F("Compteur ")); display.setCursor(70,0); snprintf(Oled_Msg,6,"% 5d",Compteur); display.print(Oled_Msg); } // model=dht.getModel(); t = dht.getTemperature(); if (isnan(t)) { Serial.println(" PB T.DHT11 "); snprintf(Humidchar,6,"%s\t"," ???"); // delay(2000); // return; } else snprintf(Tempchar,6,"%3.2f\t",t); display.setCursor(0,8); // 123456789012345678 display.print(F("DHT11 Temp. ")); display.setCursor(70,8); display.print(Tempchar); h=dht.getHumidity(); if (isnan(h)) { Serial.println(" PB H.DHT11 "); snprintf(Humidchar,6,"%s\t"," ???"); // delay(2000); // return; } else snprintf(Humidchar,6,"%2.2f\t",h); display.setCursor(0,16); display.print(F("DHT11 Humi ")); display.setCursor(70,16); display.print(Humidchar); if (BMPOK==1) { p = bmp.readPressure() / 100.0F; } else p=999.9; snprintf(Presschar,5,"%4.0f\r\n",p); display.setCursor(0,24); display.print(F("BMP085 mBar")); display.setCursor(50,24); display.print(Presschar); display.display(); TempAndHumidity lastValues = dht.getTempAndHumidity(); if (digitalRead(BP1)==HIGH) BP1_status="OFF"; else BP1_status="ON"; Compteur ++; Serial.print(" Press. "); Serial.print(p); Serial.printf(" Temp. %3.1f%cC ",lastValues.temperature,'°'); Serial.printf(" Humid % 3.1f%c",lastValues.humidity,'%'); // Serial.printf(" Humid %s %",Humidchar); Serial.print(" BP= "); Serial.print(BP1_status); Serial.println(); delay(1500); } /* sur terminal COM6 115200buad ( via liaison USBà carte LOLIN..) Test 3 leds Test AsyncWebserver avec ESP8266 LOLIN (Vert) NodeMCU V3 version :19 avril 2022 Analog Temper. sensor LM35DZ Humidity ,Temper numerical sensor DHT11 Pressure I2C Sensor BMP085 & I2C mini OLED SSD1306 128x32 Relation Pins LOLIN <---> GPIO Port 16 ESP8266 Lolin pin D0 Arduino pin GPIO16 Port 5 ESP8266 Lolin pin D1 Arduino pin GPIO5 Port 4 ESP8266 Lolin pin D2 Arduino pin GPIO4 Port 0 ESP8266 Lolin pin D3 Arduino pin GPIO0 Port 2 ESP8266 Lolin pin D4 Arduino pin GPIO2 Port 14 ESP8266 Lolin pin D5 Arduino pin GPIO14 Port 12 ESP8266 Lolin pin D6 Arduino pin GPIO12 Port 13 ESP8266 Lolin pin D7 Arduino pin GPIO13 Port 15 ESP8266 Lolin pin D8 Arduino pin GPIO15 I2C Bus sur GPIO 4 (SDA) Lolin pin D2 et sur GPIO 5 (SCL) Lolin pin D1 I2C Scanner to scan for devices on each port pair D0 to D7 I2C device found at address 0x3C I2C device found at address 0x77 Trouve 2 devices sur le Bus I2C .. Fin de test I2C bus SSD1306 allocation OK Bitmap paulfjujo 1 bit 128x32 Etat BP1 Lolin D7= GPIO13= OFF BMP180 OK Connected to YOur_SSID IP address: 192.168.0.100 HTTP server started Compteur= 00000 Consigne=00062 SommeValADC = 62 Ana0=62 Press. 984.40 Temp. 19.7°C Humid 48.1% BP= OFF Compteur= 00001 Consigne=00062 SommeValADC = 131 Ana0=69 Press. 984.37 Temp. 19.7°C Humid 48.1% BP= OFF Compteur= 00002 Consigne=00062 SommeValADC = 200 Ana0=69 Press. 984.43 Temp. 19.7°C Humid 48.1% BP= OFF Compteur= 00003 Consigne=00062 SommeValADC = 268 Ana0=68 Press. 984.40 Temp. 19.7°C Humid 48.1% BP= OFF Compteur= 00004 Consigne=00062 SommeValADC = 337 Ana0=69 Press. 984.40 Temp. 19.7°C Humid 48.1% BP= OFF Compteur= 00005 Consigne=00062 SommeValADC = 406 Ana0=69 Press. 984.35 Temp. 19.7°C Humid 48.1% BP= OFF Compteur= 00006 Consigne=00062 SommeValADC = 475 Ana0=69 Press. 984.44 Temp. 19.7°C Humid 48.2% BP= OFF Compteur= 00007 Consigne=00062 SommeValADC = 544 LM35DZ = 21.91°C Press. 984.43 Temp. 19.7°C Humid 48.2% BP= OFF Compteur= 00008 Consigne=00062 SommeValADC = 69 Ana0=69 Press. 984.46 Temp. 19.7°C Humid 48.2% BP= OFF */