Skip to content

Instantly share code, notes, and snippets.

@stritti
Last active September 18, 2018 20:52
Show Gist options
  • Save stritti/8b4880931111c08543fd572542d5d574 to your computer and use it in GitHub Desktop.
Save stritti/8b4880931111c08543fd572542d5d574 to your computer and use it in GitHub Desktop.
Read internal temperature of ESP32
#include <Arduino.h>
#include "esp_system.h"
extern "C" {
uint8_t temprature_sens_read();
}
void setup() {
Serial.begin(115200);
}
void loop() {
//get internal temp of ESP32
uint8_t temp_farenheit= temprature_sens_read();
//convert farenheit to celcius
double temp = ( temp_farenheit - 32 ) / 1.8;
System.print("internal temp [°C]: ");
System.println(temp);
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment