#include <string.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>
#include <GyverOLED.h>
#include <GyverBME280.h>
#include "Adafruit_NeoPixel.h"

GyverBME280 bme; 
GyverOLED<SSH1106_128x64> oled;

ESP8266WiFiMulti WiFiMulti;

#define PIN  D3
#define NUMPIXELS 15

Adafruit_NeoPixel strip (NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int param0 = 0;

int v;
int t;

String m = "";
String param1 = "";
String param2 = "";
String param3 = "";
String param4 = "";
String param5 = "";

int param11 = 0;
int param22 = 0;
int param33 = 0;
int param44 = 0;
int param55 = 0;

void error() {
  for (int i = 10; i <= 100; i++) {
    for (int j = 0; j <= 15; j++) {
      strip.setPixelColor(j, strip.Color(i, 0, 0));   // включаем белый цвет на 3 светодиоде
      strip.show();   // отправляем сигнал на ленту
      delay(1);
    }
  }

  for (int i = 100; i >= 10; i--) {
    for (int j = 15; j >= 0; j--) {
      strip.setPixelColor(j, strip.Color(i, 0, 0));   // включаем белый цвет на 3 светодиоде
      strip.show();   // отправляем сигнал на ленту
      delay(1);
    }
  }

}

void good() {
  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j <= 15; j++) {
      strip.setPixelColor(j, strip.Color(i, 0, i));   // включаем белый цвет на 3 светодиоде
      strip.show();   // отправляем сигнал на ленту
    }
  }

  for (int i = 100; i >= 0; i--) {
    for (int j = 15; j >= 0; j--) {
      strip.setPixelColor(j, strip.Color(i, 0, i));   // включаем белый цвет на 3 светодиоде
      strip.show();   // отправляем сигнал на ленту
    }
  }

}

void wifi() {
  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j <= 15; j++) {
      strip.setPixelColor(j, strip.Color(0, 0, i));
      strip.show();   // отправляем сигнал на ленту
    }
  }

  for (int i = 100; i >= 0; i--) {
    for (int j = 15; j >= 0; j--) {
      strip.setPixelColor(j, strip.Color(0, 0, i));
      strip.show();   // отправляем сигнал на ленту
    }
  }


}

void rainbow(int wait) {
  for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) {
    for(int i=0; i<strip.numPixels(); i++) { 
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show();
    delay(wait);
  }
}


void setup(void) {
  bme.begin();
  oled.init();              // инициализация
  Serial.begin(9600);
  Serial.write("Loading succes!");  

  strip.begin();                  
  strip.setBrightness(50);
  strip.clear();

  m = "Радуга";
  v = bme.readHumidity();
  t = bme.readTemperature();

  
  oled.autoPrintln(true);
  oled.setScale(1);
  oled.home();
  oled.print("RomAromADev      KL70");
  oled.setScale(1);
  oled.setCursor(0, 1);
  oled.print("roma-roma.ru/m12");
  //u8g.drawStr( 0, 20, "Mode: Raindown");
  
  oled.setCursor(0, 7);
  oled.print("Ожидание сети");
  oled.update();

  strip.clear();

  wifi();
  WiFi.mode(WIFI_STA);
  WiFiMulti.addAP("A063", "RomAromAW");

  //pinMode(D4, OUTPUT);

  //analogWrite(D4,100);
}

byte counter;
void loop(void) {
  //error();
  //wifi();
  //good();


  param0 = 0;
  param1 = "";
  param2 = "";
  param3 = "";
  param4 = "";
  param5 = "";
  // wait for WiFi connection
  if ((WiFiMulti.run() == WL_CONNECTED)) {

    std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);

    // client->setFingerprint(fingerprint);
    // Or, if you happy to ignore the SSL certificate, then use the following line instead:
    client->setInsecure();

    HTTPClient https;

    int s1 = 1; //ID Не трогать!
    int s2 = bme.readTemperature(); // температура
    int s3 = pressureToMmHg(bme.readPressure()); // давление
    int s4 = bme.readHumidity(); // влажность
    
    String u = "https://giass-r.ru/M12/index.php?e=";
    String u1 = String(s1);
    u = u + u1;
    u1 = "&c=";
    u = u + u1;
    u1 = String(s2);
    u = u + u1;
    u1 = "&b=";
    u = u + u1;
    u1 = String(s3);
    u = u + u1;
    u1 = "&d=";
    u = u + u1;
    u1 = String(s4);
    u = u + u1;
    //+d !!!

    Serial.print("[HTTPS] begin...\n");
    if (https.begin(*client, u)) {

      Serial.print("[HTTPS] GET...\n");
      // start connection and send HTTP header
      int httpCode = https.GET();

      // httpCode will be negative on error
      if (httpCode > 0) {
        // HTTP header has been send and Server response header has been handled
        Serial.printf("[HTTPS] GET... code: %d\n", httpCode);

        // file found at server
        if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
          String payload = https.getString();
          Serial.println(payload);

Made on
Tilda