How can I integrate this in my project?

Hallo,
I have a problem with the integration of this code.
What am I doing wrong?

        #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
        #include <SPI.h>
        #include <ESP8266WiFi.h>
        #include <BlynkSimpleEsp8266.h>
        #include <SimpleTimer.h>
        #include <DHT.h>
        int Thermostat = D1;

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

        // Your WiFi credentials.
        // Set password to "" for open networks.
        char ssid[] = "xxxxxxxxxxxxx";
        char pass[] = "xxxxxxxxxxxxxx";

        #define DHTPIN 2          // What digital pin we're connected to

        // Uncomment whatever type you're using!
        #define DHTTYPE DHT22     // DHT 11
        //#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
        //#define DHTTYPE DHT21   // DHT 21, AM2301

        DHT dht(DHTPIN, DHTTYPE);
        SimpleTimer timer;
        // This function sends Arduino's up time every second to Virtual Pin (5).
        // In the app, Widget's reading frequency should be set to PUSH. This means
        // that you define how often to send data to Blynk App.

         

          float readData = DHT.read22(dataPin); // Reads the data from the sensor
          float p = DHT.temperature; // Gets the values of the temperature
          float k = DHT.humidity; // Gets the values of the humidity
        int pinValue2;
        BLYNK_WRITE(V4) // V4 is the number of Virtual Pin  
        {pinValue2 = param.asInt();}
        {
         if (p > pinValue2){digitalWrite(Thermostat, LOW);}

          else {digitalWrite(Thermostat, HIGH);}
          
        }



        void setup()
        {
          Serial.begin(9600); // See the connection status in Serial Monitor
          Blynk.begin(auth, ssid, pass);
          pinMode(Thermostat, OUTPUT);

          // Setup a function to be called every second
          
        }

        void loop()
        {
          Blynk.run(); // Initiates Blynk
          timer.run(); // Initiates SimpleTimer
        }
  intelligenter_Thermostat:34: error: expected primary-expression before '.' token

   float readData = DHT.read22(dataPin); // Reads the data from the sensor

                       ^

intelligenter_Thermostat:34: error: 'dataPin' was not declared in this scope

   float readData = DHT.read22(dataPin); // Reads the data from the sensor

                               ^

intelligenter_Thermostat:35: error: expected primary-expression before '.' token

   float p = DHT.temperature; // Gets the values of the temperature

                ^

intelligenter_Thermostat:36: error: expected primary-expression before '.' token

   float k = DHT.humidity; // Gets the values of the humidity

                ^

intelligenter_Thermostat:40: error: expected unqualified-id before '{' token

 {

 ^

Znaleziono wiele bibliotek w "BlynkSimpleEsp8266.h"
Wykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\tools
Niewykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\libraries
Niewykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\Blynk
Niewykorzystane: D:\Arduino\libraries\tools
Niewykorzystane: D:\Arduino\libraries\libraries
Niewykorzystane: D:\Arduino\libraries\Blynk
Niewykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\libraries
Niewykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\Blynk
Niewykorzystane: D:\Arduino\libraries\tools
Niewykorzystane: D:\Arduino\libraries\libraries
Niewykorzystane: D:\Arduino\libraries\Blynk
Niewykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\libraries
Niewykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\Blynk
Niewykorzystane: D:\Arduino\libraries\tools
Niewykorzystane: D:\Arduino\libraries\libraries
Niewykorzystane: D:\Arduino\libraries\Blynk
Niewykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\libraries
Niewykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\Blynk
Niewykorzystane: D:\Arduino\libraries\tools
Niewykorzystane: D:\Arduino\libraries\libraries
Niewykorzystane: D:\Arduino\libraries\Blynk
Znaleziono wiele bibliotek w "BlynkApiArduino.h"
Wykorzystane: C:\Users\piotrsu\Documents\Arduino\libraries\Blynk
Niewykorzystane: D:\Arduino\libraries\Blynk
Niewykorzystane: D:\Arduino\libraries\Blynk
Niewykorzystane: D:\Arduino\libraries\Blynk
Niewykorzystane: D:\Arduino\libraries\Blynk
exit status 1
expected primary-expression before '.' token

Niewykorzystane means not used.
Wykorzystane means used.

All the errors are listed with exact line numbers

intelligenter_Thermostat:34: error: expected primary-expression before '.' token

   float readData = DHT.read22(dataPin); // Reads the data from the sensor

                       ^

intelligenter_Thermostat:34: error: 'dataPin' was not declared in this scope

   float readData = DHT.read22(dataPin); // Reads the data from the sensor

                               ^

intelligenter_Thermostat:35: error: expected primary-expression before '.' token

   float p = DHT.temperature; // Gets the values of the temperature

                ^

intelligenter_Thermostat:36: error: expected primary-expression before '.' token

   float k = DHT.humidity; // Gets the values of the humidity

                ^

intelligenter_Thermostat:40: error: expected unqualified-id before '{' token

 {

Lots of syntax issues… Our purpose here in this forum is to help you learn about Blynk, not to teach or troubleshoot how you code.

But look at your errors and think about what they are saying…

Declare this variable properly

Go through you code line by line and count opening and closing brackets to make sure they are all equal and the correct usage.

HINT - perhaps unnecessary use of semicolon and bracket not pointed in the correct orientation… :stuck_out_tongue_winking_eye:

also get your indentation right, that saves you a LOT of debugging, like in the above, if properly indented you immediately spot the issue:

BLYNK_WRITE(V4) // V4 is the number of Virtual Pin  
{
	pinValue2 = param.asInt();
}

{
	if (p > pinValue2)
	{
		digitalWrite(Thermostat, LOW);
	}
	else 
	{
		digitalWrite(Thermostat, HIGH);
	}
}

In case its not clear, the above code is WRONG!

Thanks for help