And now at the pin GPIO 04 the 18b20 can be connected and the 4.7k resistor to the 5v dc
Now a new python3 cod can be created
sudo nano temperature.py
the following code will just read and print to the terminal the sensor info and the temperature
from w1thermsensor import W1ThermSensor
#Read the data from the sensor
TempSensor = W1ThermSensor()
#Print sensor info
print ("the sensor info= ", TempSensor)
#Read the temperature
temperature = TempSensor.get_temperature()
#Print the temperature in Celsius, Fahrenheit and Kelvin
print("temperature in Celsius = ", temperature)
fahrenheit = (temperature*9/5)+32
print("temperature in Fahrenheit = ", fahrenheit)
kelvin = temperature+273.15
print("temperature in Kelvin = ", kelvin)