2021-01-29 06:31:58 -05:00
|
|
|
//
|
|
|
|
// FILE: mcp9808_offset.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo
|
|
|
|
// DATE: 2020-11-13
|
|
|
|
|
2021-11-08 14:21:36 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#include "mcp9808.h"
|
|
|
|
|
|
|
|
MCP9808 ts(24);
|
|
|
|
|
2021-11-08 14:21:36 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
}
|
|
|
|
|
2021-11-08 14:21:36 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
delay(500);
|
|
|
|
ts.setOffset(0);
|
|
|
|
Serial.print(ts.getTemperature(), 4);
|
|
|
|
ts.setOffset(random(200) * 0.01 - 1); // add noise +- 1°C
|
|
|
|
Serial.print('\t');
|
|
|
|
Serial.println(ts.getTemperature(), 4);
|
|
|
|
}
|
|
|
|
|
2021-11-08 14:21:36 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
// -- END OF FILE --
|
2021-11-08 14:21:36 -05:00
|
|
|
|