Class ThermistorHelper
java.lang.Object
com.opensourcewithslu.inputdevices.ThermistorHelper
-
Constructor Summary
ConstructorsConstructorDescriptionThermistorHelper(ADC0834ConverterHelper adcConverterHelper) Constructor for ThermistorHelper. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetResistance(int channel) Reads the raw value from the thermistor via ADC and converts it to resistance.doublegetTemperatureInCelsius(int channel) Calculates the temperature in Celsius using the Steinhart-Hart equation.doublegetTemperatureInFahrenheit(int channel) Converts temperature in Celsius to Fahrenheit.doublereadADCValue(int channel) Reads the ADC value from the thermistor on ADC0834.
-
Constructor Details
-
ThermistorHelper
Constructor for ThermistorHelper.- Parameters:
adcConverterHelper- The ADC0834ConverterHelper object.
-
-
Method Details
-
getResistance
public double getResistance(int channel) Reads the raw value from the thermistor via ADC and converts it to resistance.- Parameters:
channel- The ADC channel to read (0-3).- Returns:
- the resistance value of the thermistor
-
readADCValue
public double readADCValue(int channel) Reads the ADC value from the thermistor on ADC0834.- Parameters:
channel- The ADC channel to read (0-3).- Returns:
- the raw ADC value as a double
-
getTemperatureInCelsius
public double getTemperatureInCelsius(int channel) Calculates the temperature in Celsius using the Steinhart-Hart equation.- Parameters:
channel- The ADC channel to read (0-3).- Returns:
- temperature in Celsius.
-
getTemperatureInFahrenheit
public double getTemperatureInFahrenheit(int channel) Converts temperature in Celsius to Fahrenheit.- Parameters:
channel- The ADC channel to read (0-3).- Returns:
- temperature in Fahrenheit.
-