Собственно подключил библиотеку GyverEncoder. Загрузил пример. При компиляции получил вот такие ошибки.
Вложения
-
104.7 KB Просмотры: 42
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "DHT.h"
#define DHTTYPE DHT11
#define CLK D7
#define DT D6
#define SW D5
#include "GyverEncoder.h"
Encoder enc1(CLK, DT, SW);
float value = 10;
DHT dht (D4, DHTTYPE);
//DHT dht2 (D6, DHTTYPE);
#define DHTPIN D4
//#define DHTPIN D6
#include <Adafruit_BMP280.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET LED_BUILTIN
#define BMP280_I2C_ADDRESS 0x76
//#include <Wire.h>
#define BLYNK_PRINT Serial
#define RELE D8
bool rele;
Adafruit_BMP280 bmp280;
const int oneWireBus = D3;
float velue;
char auth[] = "UKL1WQF4sm4MIqqCoQpmkuktysEv9q_B";
char ssid[] = "Sosi";
char pass[] = "12345678";
float Delta = 0.5; // Дельта (Гистерезес) терморегулятора
float deltaT = 0.0;
OneWire oneWire(oneWireBus);
Adafruit_SSD1306 display(OLED_RESET);
DallasTemperature sensors(&oneWire);
WidgetLED led (V7);
const unsigned char myBitmap [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00,
0xff, 0xc0, 0x00, 0x00, 0x01, 0xc0, 0xe7, 0xf8, 0x00, 0x01, 0xc0, 0x67, 0xfc, 0x00, 0x01, 0x80,
0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xe0, 0x00, 0x01, 0x80, 0x77,
0xe0, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xfc,
0x00, 0x01, 0x80, 0x73, 0xf8, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00,
0x01, 0x80, 0x77, 0xe0, 0x00, 0x01, 0x80, 0x73, 0xe0, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01,
0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xf8, 0x00, 0x01, 0x80, 0x77, 0xf8, 0x00, 0x01, 0x80,
0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x73,
0xe0, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xfc,
0x00, 0x01, 0x9f, 0x73, 0xf8, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00,
0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01,
0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xf8, 0x00, 0x01, 0x9f, 0x77, 0xf8, 0x00, 0x03, 0x9f,
0x78, 0x00, 0x00, 0x07, 0x1f, 0x3c, 0x00, 0x00, 0x0e, 0x3f, 0x9c, 0x00, 0x00, 0x1c, 0xff, 0xce,
0x00, 0x00, 0x1c, 0xff, 0xe6, 0x00, 0x00, 0x19, 0xff, 0xb7, 0x00, 0x00, 0x39, 0xff, 0x93, 0x00,
0x00, 0x3b, 0xff, 0x93, 0x00, 0x00, 0x33, 0xff, 0xd3, 0x00, 0x00, 0x33, 0xff, 0xd3, 0x00, 0x00,
0x3b, 0xff, 0x93, 0x00, 0x00, 0x39, 0xff, 0x97, 0x00, 0x00, 0x19, 0xff, 0xa6, 0x00, 0x00, 0x1c,
0xff, 0xe6, 0x00, 0x00, 0x0c, 0x7f, 0xce, 0x00, 0x00, 0x06, 0x1f, 0x1c, 0x00, 0x00, 0x07, 0x80,
0x38, 0x00, 0x00, 0x03, 0xe1, 0xf0, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x3f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void setup()
{
enc1.setType(TYPE2);
pinMode(RELE, OUTPUT);
digitalWrite(RELE, LOW);
Serial.begin(115200);
dht.begin();
//dht2.begin();
sensors.begin();
bmp280.begin(BMP280_I2C_ADDRESS);
Blynk.begin(auth, ssid, pass);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
//delay(200);
display.clearDisplay();
}
BLYNK_CONNECTED()
{
Blynk.syncVirtual(V6);
}
BLYNK_WRITE (V6)
{
velue = param.asInt();
}
BLYNK_WRITE (V0)
{
rele = param.asInt();
digitalWrite(RELE, rele);
}
void loop()
{
{enc1.tick();
GetEncoderState();
if (enc1.isRight()) value++; // если был поворот направо, увеличиваем на 1
if (enc1.isLeft()) value--; // если был поворот налево, уменьшаем на 1
Serial.print(value); // выводим значение при повороте
Serial.print(" enkoder");
}
float temp = bmp280.readTemperature (); // get temperature
float pressure = bmp280.readPressure(); // get pressure
//Serial.print("bmp280: ºC ");
// Serial.print(temp);
// Serial.print("bmp280: pas ");
// Serial.print(pressure);
float h = dht.readHumidity();
float t = dht.readTemperature();
//Serial.print("H1: ");
//Serial.print(h);
//Serial.print(" %\t");
//Serial.print("T1: ");
//Serial.print(t);
//Serial.print(" ºC ");
sensors.requestTemperatures();
float temperatureC = sensors.getTempCByIndex(0);
//Serial.print(temperatureC);
//Serial.println(" Ds18b20ºC ");
Blynk.virtualWrite(V1, t);
Blynk.virtualWrite(V3, h);
Blynk.virtualWrite(V5, temperatureC);
Blynk.virtualWrite(V8, temp);
Blynk.virtualWrite(V9, pressure/100*0.75);
Blynk.virtualWrite(V10, deltaT);
deltaT = (t+temperatureC+temp)/3;
//Serial.print(deltaT);
//Serial.println(" deltaTºC ");
Serial.print(velue);
Serial.println(" Slaider ");
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(40, 0);
display.print("Temperatyra");
display.drawBitmap(0, 5, myBitmap, 33, 60, WHITE, BLACK);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(33, 15);
display.print(deltaT, 1);
display.print(":C");
//display.display();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(33, 40);
display.print(velue, 1);
//display.setTextSize(1);
display.print(":Vc");
//display.display();
if(deltaT <= velue-Delta)
{
led.on();
digitalWrite(RELE, LOW);
//Serial.println(" LOW");
}
else if (deltaT >= velue+Delta)
{
led.off();
digitalWrite(RELE, HIGH);
//Serial.println(" HIGH ");
}
display.display();
//delay (1000);
display.clearDisplay();
Blynk.run();
}
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "DHT.h"
#define DHTTYPE DHT11
#define CLK D7
#define DT D6
#define SW D5
#include "GyverEncoder.h"
Encoder enc1(CLK, DT, SW);
DHT dht (D4, DHTTYPE);
#define DHTPIN D4
#include <Adafruit_BMP280.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET LED_BUILTIN
#define BMP280_I2C_ADDRESS 0x76
#define BLYNK_PRINT Serial
#define RELE D8
bool rele;
Adafruit_BMP280 bmp280;
const int oneWireBus = D3;
float velue;
char auth[] = "UKL1WQF4sm4MIqqCoQpmkuktysEv9q_B";
char ssid[] = "Sosi";
char pass[] = "12345678";
float Delta = 0.5; // Дельта (Гистерезес) терморегулятора
float deltaT = 0.0;
OneWire oneWire(oneWireBus);
Adafruit_SSD1306 display(OLED_RESET);
DallasTemperature sensors(&oneWire);
WidgetLED led (V7);
const unsigned char myBitmap [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00,
0xff, 0xc0, 0x00, 0x00, 0x01, 0xc0, 0xe7, 0xf8, 0x00, 0x01, 0xc0, 0x67, 0xfc, 0x00, 0x01, 0x80,
0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xe0, 0x00, 0x01, 0x80, 0x77,
0xe0, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xfc,
0x00, 0x01, 0x80, 0x73, 0xf8, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00,
0x01, 0x80, 0x77, 0xe0, 0x00, 0x01, 0x80, 0x73, 0xe0, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01,
0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xf8, 0x00, 0x01, 0x80, 0x77, 0xf8, 0x00, 0x01, 0x80,
0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x73,
0xe0, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xfc,
0x00, 0x01, 0x9f, 0x73, 0xf8, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00,
0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01,
0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xf8, 0x00, 0x01, 0x9f, 0x77, 0xf8, 0x00, 0x03, 0x9f,
0x78, 0x00, 0x00, 0x07, 0x1f, 0x3c, 0x00, 0x00, 0x0e, 0x3f, 0x9c, 0x00, 0x00, 0x1c, 0xff, 0xce,
0x00, 0x00, 0x1c, 0xff, 0xe6, 0x00, 0x00, 0x19, 0xff, 0xb7, 0x00, 0x00, 0x39, 0xff, 0x93, 0x00,
0x00, 0x3b, 0xff, 0x93, 0x00, 0x00, 0x33, 0xff, 0xd3, 0x00, 0x00, 0x33, 0xff, 0xd3, 0x00, 0x00,
0x3b, 0xff, 0x93, 0x00, 0x00, 0x39, 0xff, 0x97, 0x00, 0x00, 0x19, 0xff, 0xa6, 0x00, 0x00, 0x1c,
0xff, 0xe6, 0x00, 0x00, 0x0c, 0x7f, 0xce, 0x00, 0x00, 0x06, 0x1f, 0x1c, 0x00, 0x00, 0x07, 0x80,
0x38, 0x00, 0x00, 0x03, 0xe1, 0xf0, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x3f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void setup()
{
enc1.setType(TYPE2);
//enc1.setTickMode(AUTO);
pinMode(RELE, OUTPUT);
digitalWrite(RELE, LOW);
Serial.begin(115200);
dht.begin();
sensors.begin();
bmp280.begin(BMP280_I2C_ADDRESS);
Blynk.begin(auth, ssid, pass);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
display.clearDisplay();
}
BLYNK_CONNECTED()
{
Blynk.syncVirtual(V6);
}
BLYNK_WRITE (V6)
{
velue = param.asInt();
}
BLYNK_WRITE (V0)
{
rele = param.asInt();
digitalWrite(RELE, rele);
}
void loop()
{
enc1.tick();{
if (enc1.isTurn())Serial.println("ya rabotay");
}
float temp = bmp280.readTemperature (); // get temperature
float pressure = bmp280.readPressure(); // get pressure
float h = dht.readHumidity();
float t = dht.readTemperature();
sensors.requestTemperatures();
float temperatureC = sensors.getTempCByIndex(0);
Blynk.virtualWrite(V1, t);
Blynk.virtualWrite(V3, h);
Blynk.virtualWrite(V5, temperatureC);
Blynk.virtualWrite(V8, temp);
Blynk.virtualWrite(V9, pressure/100*0.75);
Blynk.virtualWrite(V10, deltaT);
deltaT = (t+temperatureC+temp)/3;
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(40, 0);
display.print("Temperatyra");
display.drawBitmap(0, 5, myBitmap, 33, 60, WHITE, BLACK);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(33, 15);
display.print(deltaT, 1);
display.print(":C");
//display.display();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(33, 40);
display.print(velue, 1);
display.print(":Vc");
if(deltaT <= velue-Delta)
{
led.on();
digitalWrite(RELE, LOW);
}
else if (deltaT >= velue+Delta)
{
led.off();
digitalWrite(RELE, HIGH);
}
display.display();
//delay (1000);
display.clearDisplay();
Blynk.run();
Serial.println("the end");
}
Так и есть. Сам заметил.А сколько по времени один проход loop выполняется? Такое ощущение, что очень долго, а encTick() должен обрабатываться как можно чаще. Если один проход loop длится более 5 мкс , то уже пропуски энкодера
void loop() {
// добавлять отсюда
static uint32_t tm_m = 0;
static uint32_t cnt_m = 0;
cnt_m++;
if ((millis() - tm_m) > 1000)
{
Serial.println(cnt_m);
cnt_m = 0;
tm_m = millis();
}
// и до отсюда
enc.tick();
proc_menu();
Motors_tick();
Place_tick();
}
Вопрос с большим количеством "но" и "если" - По времени - никто тебе не скажет. Это зависит от длины кода, и его содержания, ибо разные операции выпоняются разное время, всумме набирается время чтения кода. Можешь проверить очень легко, В конце лупа вставь Serial.print() и выводи микросекунды через micros() узнаешь сколько времени код выполняется. НО!!! вывод в сериал занимает очень много времени поэтому если в коде много вывода в порт, то Луп сильно будет тормозить. Поэтому надо четко отдуплять что ты хочешь реализовать, какова будет нагрузка на проц. и какие инструменты ты будешь юзать.А сколько по времени один проход loop выполняется? Такое ощущение, что очень долго, а encTick() должен обрабатываться как можно чаще. Если один проход loop длится более 5 мкс , то уже пропуски энкодера
И ещё он в каждом лупе отрисовывает экран, очень затратное дело! Нужно отрисовывать если изменились данные для вывода на экран.И скорее всего при обращении к блинку. Ты уверен, что тебе надо обращаться к нему 40 тыщ раз в секунду и следить за температурой с такой скоростью?
void loop() {
// добавлять отсюда
static uint32_t tm_m = 0;
static uint32_t cnt_m = 0;
cnt_m++;
if ((millis() - tm_m) > 1000)
{
Serial.println(cnt_m);
cnt_m = 0;
tm_m = millis();
}
// и до отсюда
enc.tick();
proc_menu();
Motors_tick();
Place_tick();
}
void PrintBalcon(int16_t T) // тестовая функция обратного вызова, печатает только измененное значение
{
static float oldtm;
float tm = (float)T / 16.0;
if (oldtm != tm)
{
Serial.print(F("Температура на балконе: "));
Serial.println(tm);
oldtm = tm;
}
}
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "DHT.h"
#define DHTTYPE DHT11
#define CLK D6
#define DT D7
#define SW D5
#include "GyverEncoder.h"
Encoder enc1(CLK, DT, SW);
DHT dht (D4, DHTTYPE);
#define DHTPIN D4
#include <Adafruit_BMP280.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET LED_BUILTIN
#define BMP280_I2C_ADDRESS 0x76
#define BLYNK_PRINT Serial
#define RELE D8
bool rele;
Adafruit_BMP280 bmp280;
const int oneWireBus = D3;
float velue =19 ;
char auth[] = "UKL1WQF4sm4MIqqCoQpmkuktysEv9q_B";
char ssid[] = "Sosi";
char pass[] = "12345678";
//BlynkTimer timer;
float Delta = 0.5; // Дельта (Гистерезес) терморегулятора
float deltaT = 0.0;
float temp = 0.0;
float pressure = 0;
float h = 0.0;
float t = 0.0;
float temperatureC = 0.0;
float deltaT_last;
float velue_last;
uint32_t reg;
int enk;
OneWire oneWire(oneWireBus);
Adafruit_SSD1306 display(OLED_RESET);
DallasTemperature sensors(&oneWire);
WidgetLED led (V7);
const unsigned char myBitmap [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00,
0xff, 0xc0, 0x00, 0x00, 0x01, 0xc0, 0xe7, 0xf8, 0x00, 0x01, 0xc0, 0x67, 0xfc, 0x00, 0x01, 0x80,
0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xe0, 0x00, 0x01, 0x80, 0x77,
0xe0, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xfc,
0x00, 0x01, 0x80, 0x73, 0xf8, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00,
0x01, 0x80, 0x77, 0xe0, 0x00, 0x01, 0x80, 0x73, 0xe0, 0x00, 0x01, 0x80, 0x70, 0x00, 0x00, 0x01,
0x80, 0x70, 0x00, 0x00, 0x01, 0x80, 0x77, 0xf8, 0x00, 0x01, 0x80, 0x77, 0xf8, 0x00, 0x01, 0x80,
0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x73,
0xe0, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xfc,
0x00, 0x01, 0x9f, 0x73, 0xf8, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00,
0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x77, 0xe0, 0x00, 0x01, 0x9f, 0x70, 0x00, 0x00, 0x01,
0x9f, 0x70, 0x00, 0x00, 0x01, 0x9f, 0x77, 0xf8, 0x00, 0x01, 0x9f, 0x77, 0xf8, 0x00, 0x03, 0x9f,
0x78, 0x00, 0x00, 0x07, 0x1f, 0x3c, 0x00, 0x00, 0x0e, 0x3f, 0x9c, 0x00, 0x00, 0x1c, 0xff, 0xce,
0x00, 0x00, 0x1c, 0xff, 0xe6, 0x00, 0x00, 0x19, 0xff, 0xb7, 0x00, 0x00, 0x39, 0xff, 0x93, 0x00,
0x00, 0x3b, 0xff, 0x93, 0x00, 0x00, 0x33, 0xff, 0xd3, 0x00, 0x00, 0x33, 0xff, 0xd3, 0x00, 0x00,
0x3b, 0xff, 0x93, 0x00, 0x00, 0x39, 0xff, 0x97, 0x00, 0x00, 0x19, 0xff, 0xa6, 0x00, 0x00, 0x1c,
0xff, 0xe6, 0x00, 0x00, 0x0c, 0x7f, 0xce, 0x00, 0x00, 0x06, 0x1f, 0x1c, 0x00, 0x00, 0x07, 0x80,
0x38, 0x00, 0x00, 0x03, 0xe1, 0xf0, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x3f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void setup()
{
enc1.setType(TYPE2);
//enc1.setTickMode(AUTO);
pinMode(RELE, OUTPUT);
digitalWrite(RELE, LOW);
Serial.begin(115200);
dht.begin();
sensors.begin();
bmp280.begin(BMP280_I2C_ADDRESS);
Blynk.begin(auth, ssid, pass);
//timer.setInterval(6000L, myTimerEvent);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
display.clearDisplay();
}
//BLYNK_CONNECTED()
//{
// Blynk.syncVirtual(V6);
//}
BLYNK_WRITE (V6)
{
velue = param.asInt();
}
BLYNK_WRITE (V0)
{
rele = param.asInt();
digitalWrite(RELE, rele);
}
void myTimerEvent()
{
if (millis() - reg >=40000){
reg = millis();
Blynk.connect ();
temp = bmp280.readTemperature (); // get temperature
pressure = bmp280.readPressure(); // get pressure
h = dht.readHumidity();
t = dht.readTemperature();
sensors.requestTemperatures();
temperatureC = sensors.getTempCByIndex(0);
deltaT = (t + temperatureC + temp) / 3;
Blynk.virtualWrite(V1, t);
Blynk.virtualWrite(V3, h);
Blynk.virtualWrite(V5, temperatureC);
Blynk.virtualWrite(V8, temp);
Blynk.virtualWrite(V9, pressure / 100 * 0.75);
Blynk.virtualWrite(V10, deltaT);
Blynk.virtualWrite(V6, velue);
Blynk.disconnect();
//Blynk.run();
}
}
void loop()
{
enk=velue;
enc1.tick();
if (enc1.isTurn()){Serial.println("ya rabotay");
if (enc1.isRight()) enk++;
if (enc1.isLeft()) enk--;
velue=enk;
Serial.println(enk);}
myTimerEvent();
//timer.run();
if (velue != velue_last || deltaT != deltaT_last )
{
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(40, 0);
display.print("Temperatyra");
display.drawBitmap(0, 5, myBitmap, 33, 60, WHITE, BLACK);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(33, 15);
display.print(deltaT, 1);
display.print(":C");
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(33, 40);
display.print(velue, 1);
display.print(":Vc");
deltaT_last = deltaT;
velue_last = velue;
Serial.println(deltaT);
Serial.println(velue);
display.display();
display.clearDisplay();
}
if (deltaT <= velue - Delta)
{
led.on();
digitalWrite(RELE, LOW);
}
else if (deltaT >= velue + Delta)
{
led.off();
digitalWrite(RELE, HIGH);
}
// Serial.println(deltaT);
// Serial.println("the end");
//display.display();
// Blynk.run();
//Serial.println("the end");
}