void sensorsTemperatureClass::loop() {
    sensorState = digitalRead(sensorStatePin);
    if( sensorState == HIGH ) {
        rawAnalog = analogRead(sensorPin);
    } else {
        rawAnalog = -1;
    }
    //print and limit ints to 3 chars
    sprintf(lcdRows[0], "--TEMP F:%03d--", ((int) getFahrenheit()) % 1000);
    sprintf(lcdRows[1], "---K:%03d C:%03d--", ((int) getKelvin()) % 1000, ((int) getCelcius()) % 1000);
    delay(100);
}
double sensorsTemperatureClass::getCelcius() {
    return getKelvin() - 273.15;
}
示例#3
0
float getCelsius(int raw, float pinVoltage) {
	return getKelvin(raw, pinVoltage) - 273.15;
}