From 940e60378e4006c73f435b6318b7193ab66bd9cd Mon Sep 17 00:00:00 2001 From: Mikey Sklar Date: Wed, 13 Nov 2024 11:27:45 -0800 Subject: [PATCH] added setAmbientResolution No changed needed in library. Updating mcp9601_test code to include adjustable ambient resolution example. Tested on: Feather RP2040 MCP9601 Type-K Thermocouple Arduino IDE 2.3.3 --- examples/mcp9601_test/mcp9601_test.ino | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/mcp9601_test/mcp9601_test.ino b/examples/mcp9601_test/mcp9601_test.ino index 3ea680b..d6f1001 100644 --- a/examples/mcp9601_test/mcp9601_test.ino +++ b/examples/mcp9601_test/mcp9601_test.ino @@ -4,6 +4,9 @@ Adafruit_MCP9601 mcp; +/* Set and print ambient resolution */ +Ambient_Resolution ambientRes = RES_ZERO_POINT_0625; + void setup() { Serial.begin(115200); @@ -20,6 +23,16 @@ void setup() Serial.println("Found MCP9601!"); + /* Set and print ambient resolution */ + mcp.setAmbientResolution(ambientRes); + Serial.print("Ambient Resolution set to: "); + switch (ambientRes) { + case RES_ZERO_POINT_25: Serial.println("0.25°C"); break; + case RES_ZERO_POINT_125: Serial.println("0.125°C"); break; + case RES_ZERO_POINT_0625: Serial.println("0.0625°C"); break; + case RES_ZERO_POINT_03125: Serial.println("0.03125°C"); break; + } + mcp.setADCresolution(MCP9600_ADCRESOLUTION_18); Serial.print("ADC resolution set to "); switch (mcp.getADCresolution()) {