ขอคำแนะนำ Blynk หน่อยครับ ยังสับสนเรื่องโค้ดอยู่

พอดีมี Mini Project ขึ้นมาอ่ะครับ แล้วหาโค้ดดูคร่าวๆพอเอามารวมกันก็ error ตลอด พอจะแนะนำได้ไหมครับ ต้องวัด temp humid แล้วให้ควบคุมปั๊มเมื่อความชื้นน้อย ควบคุมไฟเมื่ออุณหภูมิน้อย ประมาณนี้ครับ

อันนี้โค้ดที่ดูมาครับ

#include <ESP8266WiFi.h> 

#include "DHT.h"   // library for DHT sensor                          

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID "xxxxxx"
#define BLYNK_TEMPLATE_NAME "xxxxx"
#define BLYNK_AUTH_TOKEN "xxxxxxxxxx"


#include <BlynkSimpleEsp8266.h>

WidgetLED LED_Blynk(V3);

// ----- WiFi configuration --------------
const char* ssid     =  "xxxx";          
const char* password = "xxxxx";      


#define DHTPIN    D4          
#define DHTTYPE   DHT11       // e.g. DHT11, DHT21, DHT22
DHT dht(DHTPIN, DHTTYPE);

#define LED D1
#define SW D2

float humidity = 0;     
float temperature  = 0;     

unsigned long lastDHTRead = 0, newDHTRead=0;
unsigned long lastTimeWriteFeed = 0, newTimeWriteFeed = 0;

char msg[100];
bool lamp_state  = 0;
 

BLYNK_WRITE(V2)
{
  int pin=param.asInt();
  Serial.print("Sw = ");
  Serial.println(pin);

  if (pin == 0){ 
     digitalWrite(LED, LOW); 
     LED_Blynk.on();
  } 
  else 
  {
     digitalWrite(LED, HIGH); 
     LED_Blynk.off();
  }
}


void setup() {
    pinMode(LED, OUTPUT);
    digitalWrite(LED, HIGH);
    
    Serial.begin(115200);
    dht.begin(); // initialize DHT module


    Blynk.begin(BLYNK_AUTH_TOKEN, ssid, password);

    //BlynkEdgent.begin();

      
}

void loop() {
 
        
        newDHTRead = millis();
        if(newDHTRead - lastDHTRead > 2000)  
        {
          humidity = dht.readHumidity();     // read humidity
          temperature  = dht.readTemperature();  // read temperature
          lastDHTRead = newDHTRead;

          // check if data is valid 
          if (isnan(humidity) || isnan(temperature)) 
          {
            humidity=0;
            temperature=0;
            Serial.println("Failed to read from DHT sensor!");
          }
          else
          {

            String data = "{\"data\": {\"humidity\":" + String(humidity) + 
            ", \"temperature\":" + String(temperature) + 
            "}";
            Serial.println(data);


            Blynk.run();
            //BlynkEdgent.run();
            Blynk.virtualWrite(V0, temperature); //แสดงอุณหภูมิบนแอพ Blynk
            Blynk.virtualWrite(V1, humidity); //แสดงความชื้นบนแอพ Blynk
            

          }
    
        }


        if( digitalRead(SW) == LOW)
        {
          delay(100);
          if(lamp_state == 0)
          {
            Serial.println("send (on)");
          }
          else
          {
            Serial.println("send (off)");
          }
          lamp_state = !lamp_state; 
        }

        
    delay(100);
}

อันนี้เป็นโค้ด ปั๊มครับ

#define BLYNK_PRINT Serial    
#include <BlynkSimpleEsp8266.h>
#include <ESP8266WiFi.h> // ดาวน์โหลด ไลบรารี่ที่ https://github.com/blynkkk/blynk-library
#include <SimpleTimer.h> // ดาวน์โหลด ไลบรารี่ ที่ https://github.com/jfturcot/SimpleTimer
#include <DHT.h>
#include <DHT_U.h>

char auth[] = "xxxxxx"; // ใช้ Token ที่คัดลอกจากแอพเรามาวางแทน
char pass[] = "xxxxxx"; // กรอกรหัส WIFI แทนนะครับ
char ssid[] = "xxxxx"; //กรอกชื่อ WIFI ที่ต้องการให้ ESP8266 เชื่อมต่อ

#define BLYNK_TEMPLATE_ID "TMPL6BcozApHy"
#define BLYNK_TEMPLATE_NAME "Pump"
#define BLYNK_AUTH_TOKEN "xxxxxx"

#define DHTPIN 3 //ประกาศตัวแปร DHTPIN ใช้พอร์ต 10
#define DHTTYPE DHT11
#define pump 0 //ประกาศตัวแปร pump ใช้พอร์ต 0

DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  Blynk.virtualWrite(V1, h); // เรียกให้  V5 แสดงค่าจากตัวแปร h บน Blynk
  Blynk.virtualWrite(V0, t); // เรียกให้  V6 แสดงค่าจากตัวแปร t บน Blynk
}

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass); 
  dht.begin();
  timer.setInterval(1000L, sendSensor);
  pinMode(pump, OUTPUT);
}

void loop()
{
  Blynk.run();
  timer.run();
}

ตอนนี้ได้ประมาณนี้ครับ แต่ led ไม่ติด

#include <ESP8266WiFi.h> 
#include "DHT.h"   // library for DHT sensor                          

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID "TMPL6C2cgP-Ua"
#define BLYNK_TEMPLATE_NAME "Smart farm"
#define BLYNK_AUTH_TOKEN "H6ujfxIoGVEBbck0kXli3oHxNw405HfJ"

#include <BlynkSimpleEsp8266.h>

// ----- WiFi configuration --------------
const char* ssid     =  "RUPDA";          
const char* password = "kimhun1234";      

#define DHTPIN    D3          
#define DHTTYPE   DHT11       // e.g. DHT11, DHT21, DHT22
DHT dht(DHTPIN, DHTTYPE);

#define relay1 D4
#define LEDLight D0
WidgetLED LED_Light(V5);

BlynkTimer timer;

float humidity = 0;     
float temperature  = 0;     

unsigned long lastDHTRead = 0, newDHTRead=0;
unsigned long lastTimeWriteFeed = 0, newTimeWriteFeed = 0;

int ValueOfSlider1;
BLYNK_WRITE(V2){          // V1 ถูกกำหนดให้เป็น Slider
  ValueOfSlider1 = param.asInt();
}
int ValueOfSlider2;
BLYNK_WRITE(V3){          // V1 ถูกกำหนดให้เป็น Slider
  ValueOfSlider2 = param.asInt();
}

   BLYNK_WRITE(V4){ 
if (param.asInt() == 1) {
digitalWrite(relay1, !digitalRead(relay1));
digitalWrite(LEDLight, HIGH);
if (digitalRead(relay1) == LOW) {

}
else {

}
}
if (param.asInt() == 0) {
digitalWrite(relay1, !digitalRead(relay1));
digitalWrite(LEDLight, LOW);
if (digitalRead(relay1) == HIGH) {

}
else {

}
}
}

void setup() {
    pinMode(relay1, OUTPUT);
    pinMode(LEDLight,OUTPUT);
    digitalWrite(relay1, LOW);
    digitalWrite(LEDLight, LOW); 
    
    Serial.begin(115200);
    dht.begin(); // initialize DHT module


    Blynk.begin(BLYNK_AUTH_TOKEN, ssid, password);

    //BlynkEdgent.begin();

      
}

void loop() {
 
        newDHTRead = millis();
        if(newDHTRead - lastDHTRead > 2000)  
        {
          humidity = dht.readHumidity();     // read humidity
          temperature  = dht.readTemperature();  // read temperature
          lastDHTRead = newDHTRead;

          // check if data is valid 
          if (isnan(humidity) || isnan(temperature)) 
          {
            humidity=0;
            temperature=0;
            Serial.println("Failed to read from DHT sensor!");
          }
          else
          {

            String data = "{\"data\": {\"humidity\":" + String(humidity) + 
            ", \"temperature\":" + String(temperature) + 
            "}";
            Serial.println(data);


            Blynk.run();
            //BlynkEdgent.run();
            Blynk.virtualWrite(V0, temperature); //แสดงอุณหภูมิบนแอพ Blynk
            Blynk.virtualWrite(V1, humidity); //แสดงความชื้นบนแอพ Blynk
            Blynk.virtualWrite(V2, ValueOfSlider1);
            Blynk.virtualWrite(V3, ValueOfSlider2);

            timer.run();
          }
    
        }

    delay(100);
}