forked from RobTillaart/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example how to use new status functions
- Loading branch information
1 parent
c736d5d
commit 9391368
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
libraries/MAX31855/examples/max31855_test_error/max31855_test_error.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// FILE: max31855_test_error.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.0 | ||
// PURPOSE: thermocouple lib inline tests | ||
// DATE: 2019-07-31 | ||
// URL: http://forum.arduino.cc/index.php?topic=208061 | ||
// | ||
// Released to the public domain | ||
// | ||
|
||
#include "MAX31855.h" | ||
|
||
const int doPin = 7; | ||
const int csPin = 6; | ||
const int clPin = 5; | ||
|
||
MAX31855 tc(clPin, csPin, doPin); | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.print("Start max31855_demo0: "); | ||
Serial.println(MAX31855_VERSION); | ||
Serial.println(); | ||
|
||
tc.begin(); | ||
} | ||
|
||
void loop() | ||
{ | ||
int status = tc.read(); | ||
Serial.print("stat:\t\t"); | ||
Serial.println(status); | ||
|
||
if (tc.statusError()) | ||
{ | ||
Serial.print("error:\t\t"); | ||
if (tc.shortToGND()) Serial.println("SHORT TO GROUND"); | ||
if (tc.shortToVCC()) Serial.println("SHORT TO VCC"); | ||
if (tc.openCircuit()) Serial.println("OPEN CIRCUIT"); | ||
} | ||
|
||
float internal = tc.getInternal(); | ||
Serial.print("internal:\t"); | ||
Serial.println(internal, 3); | ||
|
||
float temp = tc.getTemperature(); | ||
Serial.print("temperature:\t"); | ||
Serial.println(temp, 2); | ||
delay(1000); | ||
} | ||
|
||
// END OF FILE |