-
Notifications
You must be signed in to change notification settings - Fork 6
temperature()
Arnd edited this page Aug 19, 2017
·
2 revisions
This function returns the internal temperature of the DS3231M chip. Since this is affected by the temperature of the PCB as well as through the self-heating of the chip itself it will read higher than ambient temperatures. The value is returned in °C times 100, so 27.5°C returns as "2750". This is done so that the accuracy of 0.25°C is maintained while not having to resort to floating point variables.
...
DS3231M_Class DS3231M; // Create an instance of the DS3231M
...
void setup() {
Serial.begin(SERIAL_SPEED);
while (!DS3231M.begin()) { // Initialize RTC communications
Serial.println("Unable to find DS3231M. Checking again in 1 second.");
delay(1000);
} // of loop until device is located
Serial.print("Device temperature is ");
Serial.print(DS3231M.temperature()/100.0);
Serial.println("\xC2\xB0""C");
...
} // of setup