The temperature is fluctuating. Sometimes the actual temperature, and then suddenly -127. If I take the sensor out of the water, it still shows the correct temperature. Here's the diagram.
```
//MAX7219
//din-d7
//cs-d8
//clk-d5
//board esp8266 (nodecmu)
#include <MD_Parola.h>
//#include <MD_MAX72xx.h>
#include <SPI.h>
#include <DIYables_LED_Matrix.h>
//======================temp=================
/*
#include <OneWire.h>
#include <DallasTemperature.h>
#define SENSOR_PIN D2 // The ESP8266 pin connected to DS18B20 sensor's DQ pin
OneWire oneWire(SENSOR_PIN);
DallasTemperature DS18B20(&oneWire);
float temperature_C; // temperature in Celsius
float temperature_F; // temperature in Fahrenheit
//=========================
// Uncomment according to your hardware type
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
//#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
// Defining size, and output pins
#define NUM_MATRICES 4 // Number of cascaded MAX7219 modules
//#define CS_PIN 10 //15 voor ESP32 10 voor UNO
#define CS_PIN D8 // Chip Select pin for MAX7219
#define SPACING 2 // Spacing between characters
DIYables_Max7219 display(CS_PIN, NUM_MATRICES);
void setup() {
//=================================temp
Serial.begin(9600); // Initialize the Serial to communicate with the Serial Monitor.
DS18B20.begin(); // initialize the DS18B20 sensor
//======================================
// Initialize the LED matrix display
display.setBrightness(10); // Brightness level: 0 to 15
display.clear();
display.show();
}
void loop() {
// Display.setTextAlignment(PA_CENTER);
// Display.print("TEMP");
// delay(2000);
//==============temp
DS18B20.requestTemperatures(); // send the command to get temperatures
temperature_C = DS18B20.getTempCByIndex(0); // read temperature in °C
// temperature_F = temperature_C * 9 / 5 + 32; // convert °C to °F
// Serial.print("Temperature: ");
// Serial.print(temperature_C); // print the temperature in °C
// Serial.print("°C");
// Display.setTextAlignment(PA_CENTER);
// Display.print(temperature_C);
// delay(2000);
display.clear();
// Convert to C-style string before passing to the print() function
//String tempStr = String(temperature_C, 1); // 1 decimal place
String tempStr = String(temperature_C, 1) + "°C"; // 1 decimal place
display.print(tempStr.c_str(), SPACING, 0);
display.show();
delay(2000);
}
```