#include <TM1637.h>
#include <TM1637Display.h>
#define pin_pot A0
const int CLK = 2;
const int DIO = 3;
const float BETA = 3950;
TM1637 tm(CLK, DIO);
TM1637Display display(CLK, DIO);
float celsius;
void setup() {
tm.init();
tm.set(BRIGHT_TYPICAL);
Serial.begin(9600);
tm.display(OUTPUT);
pinMode(A0, INPUT);
}
void loop() {
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.print("Temperature: ");
Serial.print(celsius);
Serial.println(" ℃");
delay(1000);
display.setBrightness(0x0f);
display.showNumberDec(celsius, false);
delay(10);
}