-
Notifications
You must be signed in to change notification settings - Fork 9
/
Example4_3-Wire.ino
53 lines (39 loc) · 1.47 KB
/
Example4_3-Wire.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
Using the Qwiic PT100
By: Paul Clark (PaulZC)
Date: May 5th, 2020
This example demonstrates how to read the PT100 temperature in Centigrade using a 3-wire connection
Hardware Connections:
Plug a Qwiic cable into the PT100 and a BlackBoard
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
Open the serial monitor at 115200 baud to see the output
*/
#include <Wire.h>
#include <SparkFun_ADS122C04_ADC_Arduino_Library.h> // Click here to get the library: http://librarymanager/All#SparkFun_ADS122C0
SFE_ADS122C04 mySensor;
void setup(void)
{
Serial.begin(115200);
while (!Serial)
; //Wait for user to open terminal
Serial.println(F("Qwiic PT100 Example"));
Wire.begin();
//mySensor.enableDebugging(); //Uncomment this line to enable debug messages on Serial
if (mySensor.begin() == false) //Connect to the PT100 using the defaults: Address 0x45 and the Wire port
{
Serial.println(F("Qwiic PT100 not detected at default I2C address. Please check wiring. Freezing."));
while (1)
;
}
mySensor.configureADCmode(ADS122C04_3WIRE_MODE); // Configure the PT100 for 3-wire mode
}
void loop()
{
// Get the temperature in Centigrade
float temperature = mySensor.readPT100Centigrade();
// Print the temperature
Serial.print(F("The temperature is: "));
Serial.print(temperature);
Serial.println(F("C"));
delay(250); //Don't pound too hard on the I2C bus
}