I want slider set 30 and my room temp when 30 C and high relay pin

Hello friends, I’m trying to work with Blynken application, but I want to set the room temperature using slider slider that I bring in room temperature 25 to 25 i go under unless you take the role if you drop! Then I made adjustments to that value which values ​​go under him to take the role of friends there that could help wonder if I would like to Let go! Slider 30 is 30 degrees, would be on top when it comes to good work everyone

Hello. In week I think we will release Eventor widget that will allow you to that without coding.

not sure if i 100% understand, but hopefully this might help get you started:

BLYNK_WRITE(V40) //temperature slider in app
{ 
  setTemp = param.asInt();
}

void tempSetting()
{ if (roomTemp > setTemp)
  {
    digitalWrite(relayOne, HIGH); // relay you want to change
  }
  else
  {
    digitalWrite(relayOne, LOW); // relay you want to change
  }
}
1 Like

thank you i waiting for this widget… ( sorry for bad english )

you have full code i trying and not working … temp when above 25 degrees ( slider in) high relay else low … you have full code for example ?

You should be able to just add that example to your code.

you need to define these variables from your own information:

  • roomTemp
  • relayOne

i dont know how use void code and blynk_write

I started to use the new blynk and arduino my code this

> #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>
#include <DHT.h>
#include <SimpleTimer.h>
#define EspSerial Serial
ESP8266 wifi(EspSerial);
WidgetLED led1(11);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "auth code";
#define DHTPIN 2          // What digital pin we're connected to
// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  if (isnan(h) || isnan(t)) {
   
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V1, t);
  Blynk.virtualWrite(V2, h);
}
void setup()
{
EspSerial.begin(115200);
  delay(10);
  Blynk.begin(auth, wifi, "wifi id", "wifi pass");
  timer.setInterval(10000, sendData);
 // timer.setInterval(120000L, notifyUptime);
}
void sendData()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); 
Blynk.virtualWrite(V1, t);
  Blynk.virtualWrite(V2, h);
if (t >= 29)
{
led1.on();
Blynk.notify("room temperature 30 ° C above the");
Blynk.email("****@gmail.com", "Konu: room temp", "room temperature 30 ° C above the ...");
  }
  
else
{
led1.off();
}
}
void loop(){
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
 
}

can you fix your code? we cant read it…

I installed the new code this code How can I check the role according to the slider niggle room temperature

Try a different language translator, it is difficult to comprehend your question.

Role?
Niggle?

Also - i will help more in 1 hour time …

role mean relay

niggle mean set slider room temp

you help me for this subject

here is revised code:

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>
#include <DHT.h>
#include <SimpleTimer.h>
#define EspSerial Serial
ESP8266 wifi(EspSerial);

WidgetLED led1(11);

BLYNK_WRITE(V40) //temperature slider in app on pin V40
{ 
  setTemp = param.asInt();
}


// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "auth code";

#define DHTPIN 2          // What digital pin we're connected to
#define DHTTYPE DHT11     // DHT 11


DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

float roomTemp; //DHT global variable for temperature
float roomHum; //DHT global variable for humidity

void setup()
{
EspSerial.begin(115200);
  delay(10);

  Blynk.begin(auth, wifi, "wifi id", "wifi pass");
 timer.setInterval(60L * 1000L, sendData); //run send data every minute
}

void sendData()
{
 roomHum = dht.readHumidity();
  roomTemp = dht.readTemperature(); 

Blynk.virtualWrite(V1, roomTemp);
  Blynk.virtualWrite(V2, roomHum);

if (roomTemp >= setTemp)
{
led1.on();
Blynk.notify("room temperature 30 ° C above the");
Blynk.email("****@gmail.com", "Konu: room temp", "room temperature 30 ° C above the ...");
  }

else
{
led1.off();
}
}


void loop(){
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
}

i am not at home so can’t test complie this, but it might work - i hope!

I get this error

whoops, sorry!

you need to add setTemp as an integer variable up the top!

so add:

int setTemp;

just above where you declare the two DHT variables :slight_smile:

In doing this type of assembly code

im add int setTemp; and I thank you very much will test tonight

code is working, thank for helping :slight_smile: :slight_smile:

notify always say 30 C above how change this . my slider set 21 C and how make notify 21 C above or my slider set 25 C and how make notify 25 C above

:slight_smile: