int sensorPin =A0;
int bitwertNTC = 0;
long widerstand1 = 105400;
int bWert =3950;                           // B- Wert vom NTC
double widerstandNTC = 0;
double kelvintemp = 273.15;
double umgebungstemp = 20;
double Tn = kelvintemp +umgebungstemp;
double TKelvin = 0;
double T = 0;

void setup() {
Serial.begin(115200);

}

void loop() {
  if (Serial.available()>0) {
    Serial.println("Sensormessung: ");
    bitwertNTC = analogRead(sensorPin);
    widerstandNTC = widerstand1*(((double)bitwertNTC/1024)/(1-((double)bitwertNTC/1024)));
    TKelvin = 1/((1/Tn)+((double)1/bWert)*log((double)widerstandNTC/widerstand1));
    T=TKelvin-kelvintemp;
    Serial.println("Analog: ");              //
    Serial.println(bitwertNTC);              //
    Serial.println("NTC- Widerstand: ");     //Gebe die ermittelten Werte aus
    Serial.println(widerstandNTC);           //
    Serial.println("Temperatur: ");          //Gebe die ermittelten Werte aus
    Serial.println(T);                       //
 
    delay(1000);                     
  }

}
