1. If you see errors like ' Please define I/O register types here', you need to:

Delete the OneWire Folder under C:/Users/<username>/Documents/Arduino/libraries
Restart Arduino IDE
Go to tools>manage libraries
Type OneWire in the search box
Install that one that has the name Paul Stoffregen
Now restart the IDE and try compiling

You also need a 10k resistor to pull up the data pin to 3.3V. The pinout of ESP32 can be found here:

Here is the code:

#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 33

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float tc;
float tf;

void setup(){
void loop(){
void temp_check(){
  sensors.requestTemperatures();                // Send the command to get temperature readings
  tc = sensors.getTempCByIndex(0);
  tf = tc * 9 / 5 + 32;

Hardware connections: