Skip to content

Commit d59fe8c

Browse files
committed
typos & example
1 parent c45e968 commit d59fe8c

File tree

2 files changed

+74
-2
lines changed

2 files changed

+74
-2
lines changed

Adafruit_MAX31865.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/***************************************************
2-
This is a library for the Adafruit Thermocouple Sensor w/MAX31865
2+
This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
33
4-
Designed specifically to work with the Adafruit Thermocouple Sensor
4+
Designed specifically to work with the Adafruit RTD Sensor
55
----> https://www.adafruit.com/products/3328
66
77
This sensor uses SPI to communicate, 4 pins are required to

examples/max31865/max31865.ino

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/***************************************************
2+
This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
3+
4+
Designed specifically to work with the Adafruit RTD Sensor
5+
----> https://www.adafruit.com/products/3328
6+
7+
This sensor uses SPI to communicate, 4 pins are required to
8+
interface
9+
Adafruit invests time and resources providing this open source code,
10+
please support Adafruit and open-source hardware by purchasing
11+
products from Adafruit!
12+
13+
Written by Limor Fried/Ladyada for Adafruit Industries.
14+
BSD license, all text above must be included in any redistribution
15+
****************************************************/
16+
17+
#include <Adafruit_MAX31865.h>
18+
19+
// Use software SPI: CS, DI, DO, CLK
20+
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);
21+
// use hardware SPI, just pass in the CS pin
22+
//Adafruit_MAX31865 max = Adafruit_MAX31865(10);
23+
24+
// The value of the Rref resistor. Use 430.0!
25+
#define RREF 430.0
26+
27+
28+
void setup() {
29+
Serial.begin(115200);
30+
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
31+
32+
max.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
33+
}
34+
35+
36+
void loop() {
37+
uint16_t rtd = max.readRTD();
38+
39+
Serial.print("RTD value: "); Serial.println(rtd);
40+
float ratio = rtd;
41+
ratio /= 32768;
42+
Serial.print("Ratio = "); Serial.println(ratio,8);
43+
Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
44+
Serial.print("Temperature = "); Serial.println(max.temperature(100, RREF));
45+
46+
// Check and print any faults
47+
uint8_t fault = max.readFault();
48+
if (fault) {
49+
Serial.print("Fault 0x"); Serial.println(fault, HEX);
50+
if (fault & MAX31865_FAULT_HIGHTHRESH) {
51+
Serial.println("RTD High Threshold");
52+
}
53+
if (fault & MAX31865_FAULT_LOWTHRESH) {
54+
Serial.println("RTD Low Threshold");
55+
}
56+
if (fault & MAX31865_FAULT_REFINLOW) {
57+
Serial.println("REFIN- > 0.85 x Bias");
58+
}
59+
if (fault & MAX31865_FAULT_REFINHIGH) {
60+
Serial.println("REFIN- < 0.85 x Bias - FORCE- open");
61+
}
62+
if (fault & MAX31865_FAULT_RTDINLOW) {
63+
Serial.println("RTDIN- < 0.85 x Bias - FORCE- open");
64+
}
65+
if (fault & MAX31865_FAULT_OVUV) {
66+
Serial.println("Under/Over voltage");
67+
}
68+
max.clearFault();
69+
}
70+
Serial.println();
71+
delay(1000);
72+
}

0 commit comments

Comments
 (0)