Skip to content

Commit 930d661

Browse files
committed
ambient resolution in example sketch
1 parent 98b2bc6 commit 930d661

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

examples/mcp9600_test/mcp9600_test.ino

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,35 @@
77

88
Adafruit_MCP9600 mcp;
99

10+
/* Set and print ambient resolution */
11+
Ambient_Resolution ambientRes = RES_ZERO_POINT_0625;
12+
1013
void setup()
1114
{
12-
Serial.begin(115200);
13-
while (!Serial) {
14-
delay(10);
15-
}
16-
Serial.println("MCP9600 HW test");
15+
Serial.begin(115200);
16+
while (!Serial) {
17+
delay(10);
18+
}
19+
Serial.println("MCP9600 HW test");
1720

18-
/* Initialise the driver with I2C_ADDRESS and the default I2C bus. */
19-
if (! mcp.begin(I2C_ADDRESS)) {
20-
Serial.println("Sensor not found. Check wiring!");
21-
while (1);
22-
}
21+
/* Initialise the driver with I2C_ADDRESS and the default I2C bus. */
22+
if (! mcp.begin(I2C_ADDRESS)) {
23+
Serial.println("Sensor not found. Check wiring!");
24+
while (1);
25+
}
2326

2427
Serial.println("Found MCP9600!");
2528

29+
/* Set and print ambient resolution */
30+
mcp.setAmbientResolution(ambientRes);
31+
Serial.print("Ambient Resolution set to: ");
32+
switch (ambientRes) {
33+
case RES_ZERO_POINT_25: Serial.println("0.25°C"); break;
34+
case RES_ZERO_POINT_125: Serial.println("0.125°C"); break;
35+
case RES_ZERO_POINT_0625: Serial.println("0.0625°C"); break;
36+
case RES_ZERO_POINT_03125: Serial.println("0.03125°C"); break;
37+
}
38+
2639
mcp.setADCresolution(MCP9600_ADCRESOLUTION_18);
2740
Serial.print("ADC resolution set to ");
2841
switch (mcp.getADCresolution()) {

0 commit comments

Comments
 (0)