Created
October 19, 2023 08:35
-
-
Save parastuffs/715a452d7d98b068cd18b19b39408695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Make sure that the 'MCP9800' library is installed. | |
https://github.com/JChristensen/MCP9800/tree/master | |
*/ | |
#include <MCP9800.h> | |
MCP9800 mySensor; | |
void setup() | |
{ | |
Serial.begin(115200); | |
delay(1000); | |
mySensor.begin(); // initialize the hardware | |
mySensor.writeConfig(ADC_RES_12BITS); // max resolution, 0.0625 °C | |
} | |
void loop() | |
{ | |
float C = mySensor.readTempC16(AMBIENT) / 16.0; | |
Serial.println(C); | |
delay(2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment