float temp_oven, s10, s20, s30, s40;
int temp_home;
float s10=(temp_home+0.2);
float s20=(temp_home+0.2);
float s30=(temp_home+0.4);
float s40=(temp_home+0.6);
/* Servo */
Servo servo;
BLYNK_WRITE(V3)
{
servo.write(param.asInt());
}
BLYNK_WRITE(V20)
{
int temp_home = param.asInt(); // назначение переменной входящего значения с пин V20 (виджет Vstep уст. темп. подачи)
if temp_oven > temp_home
servo.write(10);
if temp_oven > (s20)
servo.write(20);
if temp_oven > (s30)
servo.write(30);
if temp_oven > (s40)
servo.write(40);
if temp_oven < (s40-0.1)
servo.write(30);
if temp_oven < (s30-0.1)
servo.write(20);
if temp_oven < (s20-0.1)
servo.write(10);
if temp_oven < temp_home
servo.write(0);
void setup()
{
servo.write(0);
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
DS18B20.begin();
servo.attach(D2); // сервопривод на D4 ESP8266
timer.setInterval(1234L, getSendData);
}
void loop()
{
timer.run(); // Initiates SimpleTimer
Blynk.run();
}
/***************************************************
* Send Sensor data to Blynk
**************************************************/
void getSendData()
{
DS18B20.requestTemperatures();
temp_oven = DS18B20.getTempCByIndex(0);
Blynk.virtualWrite(1, temp_oven);