temperatura

z klima, 6 miesiące temu, napisane w C++, wyświetlone 58 razy. [paste_expire] 4 miesiące.
URL https://pastebin.k4be.pl/view/518af493 Udostępnij
Pobierz wklejkę lub Pokaż surowy tekst
  1.  double output_voltage, thermistor_resistance, therm_res_ln, temperature;
  2.   int thermistor_adc_val;
  3.   thermistor_adc_val = ADC_NTC.get();
  4.   output_voltage = ( (thermistor_adc_val * 5.0) / 1023.0 );
  5.   thermistor_resistance = ( ( 5 * ( 10.0 / output_voltage ) ) - 10 ); /* Resistance in kilo ohms */
  6.   thermistor_resistance = thermistor_resistance * 1000 ; /* Resistance in ohms   */
  7.   therm_res_ln = log(thermistor_resistance);
  8.   /*  Steinhart-Hart Thermistor Equation: */
  9.   /*  Temperature in Kelvin = 1 / (A + B[ln(R)] + C[ln(R)]^3)   */
  10.   /*  where A = 0.001129148, B = 0.000234125 and C = 8.76741*10^-8  */
  11.   temperature = ( 1 / ( 0.001129148 + ( 0.000234125 * therm_res_ln ) + ( 0.0000000876741 * therm_res_ln * therm_res_ln * therm_res_ln ) ) ); /* Temperature in Kelvin */
  12.   temperature = temperature - 273.15; /* Temperature in degree Celsius */
  13.   temperatura = temperature;

odpowiedź "temperatura"

Tutaj możesz odpowiedzieć na wklejkę z góry

captcha