Ejemplo n.º 1
0
    def value_from_samples(self):
        adc_average = self.adc_sample_total / self.adc_sample_count
        volts = spireader.adc_to_volts(adc_average)

        temp = 0

        if volts:
            thermistor_ohms = round(
                (spireader.reference_voltage() * self.series_resistor / volts) - self.series_resistor)
            temp = thermistor_ohm_to_f(thermistor_ohms)

        return temp
Ejemplo n.º 2
0
    def get_temp(self):
        adc_read = spireader.adc_read(self.adc_channel)
        volts = spireader.adc_to_volts(adc_read)

        temp = 0

        if volts:
            temp_c = (volts - 0.5) * 100.0
            temp = temp_c * 1.8 + 32.0

        print volts

        return temp