DHT11 Not reporting anything

Hello! I’ve been using PietteTech_DHT library for my DHT22 before with great success, nothing weird, no problems. I’ve been trying the whole day to get it to work with a new Photon I bought and a DHT11, but to no avail. I only get readings when I remove the whole “if (!DHT.acquiring())” wrapper, but then it’s ofc broken and only publishes -5 degrees. i use Firmware and bootloader version 7.0. Greatly appreciate all help:) This is just one of mye example codes. Been trying to get Adafruits library to work as well but I have problems with the header file. Been trying so much now it’s too much to write.

Heres the code(sorry in advance lol):
        // This #include statement was automatically added by the Particle IDE.
        #include "PietteTech_DHT.h"

        int temperature; 
        int humidity;
        int blue = D3;
        int LOOP_DELAY = 10000; // time is in ms

        #define DHTTYPE  DHT11              // Sensor type DHT11/21/22/AM2301/AM2302
        #define DHTPIN  D2         	      // Digital pin for communications
        #define DHT_SAMPLE_INTERVAL   2000  // Sample every two seconds

        void dht_wrapper();

        PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);

        unsigned int DHTnextSampleTime; 
        bool bDHTstarted;		         
        int n;                 
        void setup() {
            pinMode(blue, OUTPUT);
            DHTnextSampleTime = 0;


        void dht_wrapper() {

        void loop() {
          if (millis() > DHTnextSampleTime) {
        	if (!bDHTstarted) {	
        	    bDHTstarted = true;

            if (!DHT.acquiring()) {	

            // get DHT status
            int result = DHT.getStatus();
            int humidity = DHT.getHumidity();
            int tempc = DHT.getCelsius();

            digitalWrite(blue, HIGH);

            Particle.publish("Humidity", String(humidity));
            Particle.publish("Temperature", String(tempc));

            digitalWrite(blue, LOW);

            bDHTstarted = false; 
            DHTnextSampleTime = millis() + DHT_SAMPLE_INTERVAL;  


Have you tried with another sensor or the sensor on another Photon?
Maybe that one is defective.
Also how have you wired the sensor?

Since there isn’t anything the immediately stands out as wrong in your code, other possible causes may need to be considered.

Two things should be changed tho’

  if (millis() > DHTnextSampleTime) {
    DHTnextSampleTime = millis() + DHT_SAMPLE_INTERVAL; 

should rather be

  if (millis() - DHTlastSample > DHTnextSampleTime) { // <-- this works more reliable with wrap-over of millis()
    DHTlastSample = millis();
    delay(LOOP_DELAY); // <-- the delay is only required after the actual publishes, 
                       // otherwise loop() should be allowed to run free

And for better practice, pull your two events together into one and publish them as PRIVATE.

            int   result   = DHT.getStatus();
            float humidity = DHT.getHumidity();
            float tempc    = DHT.getCelsius();
            char  msg[64];
            snprintf(msg, sizeof(msg), "Humidity: %.1f %%, Temperature: %.1f °C", humidity, tempc); 
            Particle.publish("Environment", msg, PRIVATE);