====== ESP32 DS18B20 ===== This is an example of the ds18b20 running and showcasing temperature using the 16x2 lcd. ===== Prequisits ==== Platform.ini lib_deps = adafruit/Adafruit LiquidCrystal@^2.0.2 milesburton/DallasTemperature@^3.11.0 ===== Example ==== #include #include #include /* DS18B20 */ #define ONE_WIRE_BUS 14 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); #define LCD_RS 48 #define LCD_ENABLE 47 #define LCD_D4 34 #define LCD_D5 33 #define LCD_D6 26 #define LCD_D7 21 static Adafruit_LiquidCrystal lcd(LCD_RS, LCD_ENABLE, LCD_D4, LCD_D5, LCD_D6, LCD_D7); void setup() { if (!lcd.begin(16, 2)) { Serial.println("Could not init LCD"); while(1); } Serial.println("LCD ready."); // Print a message to the LCD. lcd.print("IOT-OPEN"); /* ds18b20 setup */ sensors.begin(); } void loop() { sensors.requestTemperatures(); lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(sensors.getTempCByIndex(0)); delay(1000); }