Ultrasonic sensor HC-sr04 doesn't work, conflict?

Hi, i’m using a D1 mini board with a 1.8 inch TFT SPI LCD and a ultrasonic sensor HC-sr04
My project is about a weather station so i also have "WundergroundClient and TimeClient librarys

Here is my code(simplified):

#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#include <Adafruit_ST7735.h>
#include <Adafruit_GFX.h>
#include <SPI.h>
#include "WundergroundClient.h"
#include "TimeClient.h"

#include <Ultrasonic.h>

#define TRIGGER_PIN D6
#define ECHO_PIN D2


#define cs   D8
#define dc   D3
#define rst  D4

// Color definitions
#define BLACK    0x0000

//const char* ssid     = "G3orG3";      // SSID of local network
//const char* password = "xxxx";   // Password on network

// TimeClient settings
const float UTC_OFFSET = 3;

// Wunderground Settings
const boolean IS_METRIC = true;
const String WUNDERGRROUND_API_KEY = "xxx";
const String WUNDERGRROUND_LANGUAGE = "RO";
const String WUNDERGROUND_COUNTRY = "RO";
const String WUNDERGROUND_CITY = "xxxx";

TimeClient timeClient(UTC_OFFSET);

// Set to false, if you prefere imperial/inches, Fahrenheit
WundergroundClient wunderground(IS_METRIC);

Ultrasonic ultrasonic(TRIGGER_PIN, ECHO_PIN); // (Trig PIN,Echo PIN)

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst); //initialize LCD



void setup() {

  Serial.begin(115200);
  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
  tft.setRotation(3);
  tft.fillScreen(BLACK);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
  Serial.println("Connected");

}

void loop() {
  Serial.println(ultrasonic.Ranging(CM));
  delay(1000);
}

In the serial output i got the connected msg from the setup and then only the number 51 as the result ultrasonic sensor

I also tried using NewPing library
I also tried to measure the distance using this:

digitalWrite(TRIGGER_PIN, LOW);
    delayMicroseconds(2);

    // Sets the TRIGGER_PIN on HIGH state for 10 micro seconds
    digitalWrite(TRIGGER_PIN, HIGH);
    delayMicroseconds(10);
    digitalWrite(TRIGGER_PIN, LOW);

    // Reads the echoPin, returns the sound wave travel time in microseconds
    int duration = pulseIn(ECHO_PIN, HIGH);

    // Calculating the distance
    int dist = (duration * 0.034) / 2;
    Serial.println(dist);

but still no luck !

Sure your wiring is correct, and you have set the correct pins for trig and echo in your sketch?

wvmarle: Sure your wiring is correct, and you have set the correct pins for trig and echo in your sketch?

Yes i even used other pins But when i upload only the code for ultrasonic it works

Ah, that's important to know. So the sensor is in working order.

How do you power the LCD screen? If through the WeMOS that's probably your problem: unstable/insufficient power for the HC-SR04.

wvmarle: Ah, that's important to know. So the sensor is in working order.

How do you power the LCD screen? If through the WeMOS that's probably your problem: unstable/insufficient power for the HC-SR04.

I have a step down convertor to power them Another thing to know is that everything is working(including lcd and weather updates) even the sensor doesn't