Tft and ds18b20

when i use the tft display the ds18b20
if i comment out the begin for the display the ds18b20 works but i dont know how to remove that conflict ive tried 2 diffrent libs for the temp sensor


#include "painlessMesh.h"
#include <Arduino.h>
#define   MESH_PREFIX     "whateverYouLike"
#define   MESH_PASSWORD   "somethingSneaky"
#define   MESH_PORT       5555


#include "DS18B20_INT.h"


#define ONE_WIRE_BUS            12

OneWire     oneWire(ONE_WIRE_BUS);
DS18B20_INT sensor(&oneWire);


Scheduler userScheduler; 
painlessMesh  mesh;


#include "Ucglib.h"  // Include Ucglib library to drive the display

    
// Create display and define the pins:
Ucglib_ST7735_18x128x160_HWSPI ucg(2, 15, 0);  // (A0=2, CS=10, RESET=9)
// The rest of the pins are pre-selected as the default hardware SPI for Arduino Uno (SCK=13 and SDA=11)






int Variable1;  // Create a variable to have something dynamic to show on the display
int temp1=0,temperature1=20;//hemma
int temp2=0,temperature2=5;//borta
String tempstring;
int anval;
float current=0;

void sendMessage() ; // Prototype so PlatformIO doesn't complain

Task taskSendMessage( TASK_SECOND * 1 , TASK_FOREVER, &sendMessage );

void sendMessage() {




  ucg.setPrintPos(60, 120);     // Set position (x,y)

   
  ucg.print(current);
  Serial.println(current);
   taskSendMessage.setInterval(10000);
}





void setup(void)  // Start of setup
{

  // start serial port
  Serial.begin(115200);
  

  // Start up the library
  sensor.begin();
    // request to all devices on the bus



    delay(100);
  // Display setup:
  pinMode(4, OUTPUT);   
  pinMode(5, INPUT_PULLUP);  
  pinMode(16, INPUT);
  digitalWrite(4, HIGH);


  // Select a type of text background:
  //ucg.begin(UCG_FONT_MODE_TRANSPARENT);  // It doesn't overwrite background, so it's a mess for text that changes
 // ucg.begin(UCG_FONT_MODE_SOLID);  // It writes a background for the text. This is the recommended option
  
  ucg.clearScreen();  // Clear the screen

  // Set display orientation:
  ucg.setRotate270();  // Put 90, 180 or 270, or comment to leave default


  ucg.setFont(ucg_font_7x14B_mr);
  ucg.setColor(0, 255, 255, 255);  // Set color (0,R,G,B)
  ucg.setColor(1, 0, 0, 0);  // Set color of text background (1,R,G,B)
  ucg.setPrintPos(0,11);  // Set position (x,y)
  ucg.print("HEMMA            BORTA");
  delay(1000);
  ucg.setFont(ucg_font_inb46_mr);

 mesh.setDebugMsgTypes( ERROR | STARTUP );  // set before init() so that you can see startup messages

  mesh.init( MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT );
Serial.println("itwork");
    userScheduler.addTask( taskSendMessage );
    Serial.println("itwork");
  taskSendMessage.enable();
 
    ucg.print("test");
     
 
}  // End of setup









void loop(void){
  mesh.update();
 


  // Read analog value
  anval = analogRead(0);

  // Adjust temperature1 based on analog value
  if (anval < 100) {
    temperature1--;
    delay(200);
  } else if (anval < 750 && anval > 100) {
    temperature1++;
    delay(200);
  }

  // Increment temperature2 if button on pin 5 is pressed
  if (digitalRead(5) == LOW) {
    temperature2--;
    delay(200);
  }

  // Decrement temperature2 if button on pin 16 is pressed
  if (digitalRead(16) == LOW) {
    temperature2++;
    delay(200);
  }

  

  // Update display if temperature1 changes
  if (temperature1 != temp1) {
    
    tempstring = String(temperature1);
    temp1 = temperature1;
    if (temperature1 < 10)
      tempstring += " ";
    ucg.setColor(0, 255, 0, 0);  // Set color (0,R,G,B)
    ucg.setColor(1, 0, 0, 0);    // Set color of text background (1,R,G,B)
    ucg.setPrintPos(-3, 60);     // Set position (x,y)
    ucg.print(tempstring);
    
  }
 

  // Update display if temperature2 changes
  if (temperature2 != temp2) {
    tempstring = String(temperature2);
    temp2 = temperature2;
    if (temperature2 < 10)
      tempstring += " ";
    ucg.setColor(0, 0, 0, 255);  // Set color (0,R,G,B)
    ucg.setColor(1, 0, 0, 0);    // Set color of text background (1,R,G,B)
    ucg.setPrintPos(80, 60);     // Set position (x,y)
    ucg.print(tempstring);
  }

 sensor.requestTemperatures();

  //  BLOCKING!!  blocks until sensor is ready


  Serial.print("Temp: ");
  Serial.println(sensor.getTempC());
 // current = temporary;
  delay(10);
}
 // End of loop

what is the host microcontroller?
how have you connected the devices?

If an Uno, you can't use pin 12 when using the SPI bus.
Pins 11-13 are SPI. Use another pin. like 4.

wesmos d1 mini clone from aliexpress uses esp8266. both things work independently not together

is it similar for this do i have to move the pins around?

If this is an Uno, then
SCLK to 13
MISO to 12
MOSI to 11

This is why you can't use 12 for the sensor.

its wesmos d1 mini

when I used the DS18B20 on a ESP8266 I used the dallastemperature library with the sensor connected to pin 4 - worked OK
however, you should be able to use any GPIO pin which allows input and output - see esp8266-pinout-reference-gpios

which TFT are you using?

ive used dalatemperature and it works but when i try to use the display at the same time it dosnt as soon as the display is started it stops working

this display i use 7 pin one https://vi.aliexpress.com/item/1005003152078101.html?spm=a2g0o.order_list.order_list_main.34.5c2c1802a4MYzu&gatewayAdapt=glo2vnm

try this code

// ESP8266 to ILI9341 and DS18B20

/***************************************************
  This is our GFX example for the Adafruit ILI9341 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

// ESP8266 to ILI9341 color TFT display connections
// ESP8266 SCK  pin GPIO12 to display  SCLK
// ESP8266 MISO pin GPIO13 to display  SDO
// ESP8266 MOSI pin GPIO11 to display  SDI
// ESP8266 SS   pin GPIO10

#define TFT_CS 10  // no connection on ILI9341
#define TFT_DC 16
#define TFT_MOSI 13
#define TFT_CLK 14
#define TFT_RST 2
#define TFT_MISO 12

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

#include <OneWire.h>
#include <DallasTemperature.h>
/********************************************************************/
// Data wire is plugged into pin GPIO4 on the ESP8266
#define ONE_WIRE_BUS 4  
/********************************************************************/
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
/********************************************************************/
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
void setup() {
  Serial.begin(115200);
  delay(3000);
  Serial.println("\n\nILI9341 - DS18B20 Test!");
  sensors.begin();
  tft.begin();
  // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
  Serial.print("Display Power Mode: 0x");
  Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDMADCTL);
  Serial.print("MADCTL Mode: 0x");
  Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDPIXFMT);
  Serial.print("Pixel Format: 0x");
  Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDIMGFMT);
  Serial.print("Image Format: 0x");
  Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDSELFDIAG);
  Serial.print("Self Diagnostic: 0x");
  Serial.println(x, HEX);

  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.println("ILI9341/DS18B20 Test!");
}


void loop(void) {
  Serial.print(" Requesting temperatures...");
  sensors.requestTemperatures();  // Send the command to get temperature readings
  Serial.println("DONE");
  /********************************************************************/
  Serial.print("Temperature is: ");
  Serial.print(sensors.getTempCByIndex(0));  // Why "byIndex"?
  tft.println(sensors.getTempCByIndex(0));
  delay(5000);
}

serial monitor displays

ILI9341 - DS18B20 Test!
Display Power Mode: 0x94
MADCTL Mode: 0x48
Pixel Format: 0x5
Image Format: 0x80
Self Diagnostic: 0xC0
Temperature is: 25.81 Requesting temperatures...DONE
Temperature is: 26.75 Requesting temperatures...DONE
Temperature is: 28.31 Requesting temperatures...DONE
Temperature is: 29.38 Requesting temperatures...DONE
Temperature is: 30.13 Requesting temperatures...DONE
Temperature is: 30.69 Requesting temperatures...DONE
Temperature is: 31.00 Requesting temperatures...DONE
Temperature is: 30.81 Requesting temperatures...DONE
Temperature is: 30.44 Requesting temperatures...DONE

the IL19341 displays