# ESP32 based DS18B20 temperature sensor for BBL P1S chamber temp
from machine import Pin, I2C
import ssd1306, onewire, time, ds18x20, ujson, network
from umqtt.simple import MQTTClient
# MQTT variables
MQTT_CLIENT_ID = ""
MQTT_BROKER = ""
MQTT_USER = ""
MQTT_PASSWORD = ""
MQTT_TOPIC = ""
# ESP32 Pin assignment
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
# OneWire assignment
ow = onewire.OneWire(Pin(18))
# DS18B20
ds = ds18x20.DS18X20(ow)
# OLED
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
roms = ds.scan()
ds.convert_temp()
time.sleep_ms(750)
for rom in roms:
print(ds.read_temp(rom))