ESP8266 Read DS18B20 from GPIO 1 (TX)

I have ESP8266 board and sensor DS18B20
And i need to really read the temperature from GPIO1 (TX) port.

#include <OneWire.h>
#include <DallasTemperature.h>

// GPIO where the DS18B20 is connected to
const int oneWireBus = 1;     

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(oneWireBus);

// Pass our oneWire reference to Dallas Temperature sensor 
DallasTemperature sensors(&oneWire);

void setup() {
  // Start the Serial Monitor
  Serial.begin(9600);
  pinMode(1, FUNCTION_3);
  // Start the DS18B20 sensor
  sensors.begin();
}

void loop() {
  sensors.requestTemperatures(); 
  float temperatureC = sensors.getTempCByIndex(0);
  float temperatureF = sensors.getTempFByIndex(0);
  Serial.print(temperatureC);
  Serial.println("ºC");
  Serial.print(temperatureF);
  Serial.println("ºF");
  delay(5000);
}

Thanks

Can you use pin 4 and follow this example: https://randomnerdtutorials.com/esp8266-nodemcu-mqtt-publish-ds18b20-arduino/, just ignore the mqtt part.

If you bought your DS18B20 from Aliexpress/Ebay/Amazon, then it is probably a counterfeit. I might only work reliable at 5V and only up to 75°C.
Do you have a pullup resistor ?

Hello @antons15, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.