How to send a value from Blynk to Arduino?

Hi All,
I am doing my project by using blynk and arduino mega.
This code is to control Relay by measuring temperature and humidity through dht11.
Now I programmed that Relay is off when the humidity is over 60 which is the fixed value.
However, I want to add slider or other input switch to set the humidity value on the app. And then the set value is sent from Blynk to Arudino. Therefore, Relay will be on or off, depending on the set value.
I’ve been trying it but failed.
Please anybody can help me?
Thank you.

#define BLYNK_PRINT SwSerial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleStream.h>
#include <DHT.h>
char auth[] = "*****************************";
#define DHTPIN A1          
#define DHTTYPE DHT11     // DHT 11
BlynkTimer timer;
void sendSensor()
  int h = dht.readHumidity();
  int t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  /*if (isnan(h) || isnan(t)) {
    SwSerial.println("Failed to read from DHT sensor!");
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
void setup()
  // Debug console
  // Blynk will work through Serial
  // Do not read or write this serial manually in your sketch
  Blynk.begin(Serial, auth);
  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
void loop()

Please repost code, properly formatted as instructed, thanks. - Moderator

Blynk - FTFC

I don’t see any attempts in your code?

I tried but didnt posted it here

Well, try adding in a BLYNK_WRITE() function using a slider to change a global variable used instead of the value of 60

And even more straightforward: