Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.46 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.46 KB

Arduino CI Arduino-lint code size: GitHub release License: MIT

CPU Temperature

Measure the internal temperature of the processor.

Retrieve the temperature of the internal ATMega328 processor using nothing more than the internal registers.

NO external parts or connectins are necessary. All that is needed is the Atmel microcontroller itself. That's it.

Example use:

    #include <CPUTemp.h>
    
    // We don't need a setup and a loop function so we just use a single main:
    int main() {
        Serial.begin(115200);

        // Read the processor temperature:
        double temp = temperature();
    
        // Format it as a string to 2 decimal places:
        char fstr[8];
        dtostrf(temp, 6, 2, fstr);
    
        // Display it:
        Serial.print("temperature: ");
        Serial.println(fstr);
    
        return 0;
    }

output:

    temperature: 96.70