0.3.0 MAX31855_RT

This commit is contained in:
rob tillaart 2021-08-12 11:47:56 +02:00
parent 9e75649520
commit 8909f428ff
12 changed files with 515 additions and 111 deletions

View File

@ -1,12 +1,15 @@
//
// FILE: MAX31855.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.2.5
// VERSION: 0.3.0
// PURPOSE: Arduino library for MAX31855 chip for K type thermocouple
// DATE: 2014-01-01
// URL: https://github.com/RobTillaart/MAX31855_RT
//
// HISTORY:
// 0.3.0 2021-08-11 VSPI / HSPI support for ESP32
// add setGIOpins - ESP32 specific
// add get/setSPIspeed() - all
// 0.2.5 2021-07-04 fix #14 CS for STM32
// 0.2.4 2020-12-30 arduinoCI, unit test
// 0.2.3 2020-08-30 fix #8 support hardware SPI + example
@ -30,53 +33,89 @@
#include "MAX31855.h"
MAX31855::MAX31855(const uint8_t cs)
MAX31855::MAX31855(const uint8_t select)
{
_cs = cs;
_hwSPI = true;
_offset = 0;
_SC = K_TC;
_status = STATUS_NOREAD;
_temperature = MAX31855_NO_TEMPERATURE;
_internal = MAX31855_NO_TEMPERATURE;
_rawData = 0;
MAX31855(255, select, 255);
}
MAX31855::MAX31855(const uint8_t sclk, const uint8_t cs, const uint8_t miso)
MAX31855::MAX31855(const uint8_t clock, const uint8_t select, const uint8_t miso)
{
_sclk = sclk;
_cs = cs;
_clock = clock;
_select = select;
_miso = miso;
_hwSPI = false;
_hwSPI = (clock == 255);
_offset = 0;
_SC = K_TC;
_status = STATUS_NOREAD;
_temperature = MAX31855_NO_TEMPERATURE;
_internal = MAX31855_NO_TEMPERATURE;
_rawData = 0;
_lastTimeRead = 0;
_offset = 0;
_SeebeckC = K_TC;
_status = STATUS_NOREAD;
_temperature = MAX31855_NO_TEMPERATURE;
_internal = MAX31855_NO_TEMPERATURE;
_rawData = 0;
}
void MAX31855::begin()
{
pinMode(_cs, OUTPUT);
digitalWrite(_cs, HIGH);
pinMode(_select, OUTPUT);
digitalWrite(_select, HIGH);
_spi_settings = SPISettings(_SPIspeed, MSBFIRST, SPI_MODE0);
if (_hwSPI)
{
SPI.begin();
#if defined(ESP32)
if (_useHSPI) // HSPI
{
mySPI = new SPIClass(HSPI);
mySPI->end();
mySPI->begin(14, 12, 13, _select); // CLK=14 MISO=12 MOSI=13
}
else // VSPI
{
mySPI = new SPIClass(VSPI);
mySPI->end();
mySPI->begin(18, 19, 23, _select); // CLK=18 MISO=19 MOSI=23
}
#else // generic hardware SPI
mySPI = &SPI;
mySPI->end();
mySPI->begin();
#endif
delay(1);
}
else
{
pinMode(_sclk, OUTPUT);
pinMode(_clock, OUTPUT);
digitalWrite(_clock, LOW);
pinMode(_miso, INPUT);
}
}
void MAX31855::setSPIspeed(uint32_t speed)
{
_SPIspeed = speed;
_spi_settings = SPISettings(_SPIspeed, MSBFIRST, SPI_MODE0);
};
#if defined(ESP32)
void MAX31855::setGPIOpins(uint8_t clock, uint8_t miso, uint8_t mosi, uint8_t select)
{
_clock = clock;
_miso = miso;
_select = select;
pinMode(_select, OUTPUT);
digitalWrite(_select, HIGH);
mySPI->end(); // disable SPI
mySPI->begin(clock, miso, mosi, select);
}
#endif
uint8_t MAX31855::read()
{
// return value of _read()
@ -98,7 +137,7 @@ uint8_t MAX31855::read()
return _status;
}
_lastRead = millis();
_lastTimeRead = millis();
// process status bit 0-2
_status = value & 0x0007;
@ -115,7 +154,7 @@ uint8_t MAX31855::read()
// process internal bit 4-15
_internal = (value & 0x07FF) * 0.0625;
// negative flag set ?
if (value & 0x0800)
if (value & 0x0800)
{
_internal = -128 + _internal;
}
@ -142,32 +181,32 @@ uint8_t MAX31855::read()
uint32_t MAX31855::_read(void)
{
_rawData = 0;
// DATA TRANSFER
if (_hwSPI)
{
SPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE0));
digitalWrite(_cs, LOW); // must be after SPI.beginTransaction() - see #14 STM32
mySPI->beginTransaction(_spi_settings);
digitalWrite(_select, LOW); // must be after mySPI->beginTransaction() - see #14 STM32
for (uint8_t i = 0; i < 4; i++)
{
_rawData <<= 8;
_rawData += SPI.transfer(0);
_rawData += mySPI->transfer(0);
}
digitalWrite(_cs, HIGH);
SPI.endTransaction();
digitalWrite(_select, HIGH);
mySPI->endTransaction();
}
else
else // Software SPI
{
digitalWrite(_cs, LOW);
digitalWrite(_select, LOW);
for (int8_t i = 31; i >= 0; i--)
{
_rawData <<= 1;
digitalWrite(_sclk, LOW);
digitalWrite(_clock, LOW);
// delayMicroseconds(1); // DUE
if ( digitalRead(_miso) ) _rawData++;
digitalWrite(_sclk, HIGH);
digitalWrite(_clock, HIGH);
// delayMicroseconds(1); // DUE
}
digitalWrite(_cs, HIGH);
digitalWrite(_select, HIGH);
}
return _rawData;
@ -179,15 +218,16 @@ float MAX31855::getTemperature()
// offset needs to be added after multiplication TCfactor
// not before otherwise offset will be larger / smaller
// default behaviour
if (_SC == K_TC) return _temperature + _offset;
if (_SeebeckC == K_TC) return _temperature + _offset;
// EXPERIMENTAL OTHER THERMOCOUPLES
// to be tested
// in practice this works also for K_TC but is way slower..
// 1: reverse calculate the Voltage measured
// 1: reverse calculate the Voltage measured (is this correct?)
float Vout = K_TC * (_temperature - _internal); // PAGE 8 datasheet
// 2: from Voltage to corrected temperature using the Seebeck Coefficient
float _temp = Vout / _SC + _internal;
float _temp = Vout / _SeebeckC + _internal + _offset;
return _temp;
}

View File

@ -2,7 +2,7 @@
//
// FILE: MAX31855.h
// AUTHOR: Rob Tillaart
// VERSION: 0.2.5
// VERSION: 0.3.0
// PURPOSE: Arduino library for MAX31855 chip for K type thermocouple
// DATE: 2014-01-01
// URL: https://github.com/RobTillaart/MAX31855_RT
@ -13,7 +13,7 @@
//
// +---------+
// Vin | o |
// 3Vo | o |
// 3V3 | o |
// GND | o O | Thermocouple
// D0 | o O | Thermocouple
// CS | o |
@ -25,11 +25,11 @@
#include "SPI.h"
#define MAX31855_VERSION (F("0.2.5"))
#define MAX31855_VERSION (F("0.3.0"))
#define MAX31855_NO_TEMPERATURE -999
// STATE constants returnd by read()
// STATE constants returned by read()
#define STATUS_OK 0x00
#define STATUS_OPEN_CIRCUIT 0x01
#define STATUS_SHORT_TO_GND 0x02
@ -64,52 +64,76 @@ class MAX31855
{
public:
// HW SPI
MAX31855(uint8_t CS);
MAX31855(uint8_t select);
// SW SPI
MAX31855(uint8_t SCLK, uint8_t CS, uint8_t MISO);
void begin();
MAX31855(uint8_t clock, uint8_t select, uint8_t miso);
void begin();
// returns state - bit field: 0 = STATUS_OK
uint8_t read();
uint8_t read();
float getInternal(void) const { return _internal; }
float getTemperature(void);
float getInternal(void) const { return _internal; }
float getTemperature(void);
uint8_t getStatus(void) const { return _status; };
inline bool openCircuit() { return _status == STATUS_OPEN_CIRCUIT; };
inline bool shortToGND() { return _status == STATUS_SHORT_TO_GND; };
inline bool shortToVCC() { return _status == STATUS_SHORT_TO_VCC; };
inline bool genericError() { return _status == STATUS_ERROR; };
inline bool noRead() { return _status == STATUS_NOREAD; };
inline bool noCommunication() { return _status == STATUS_NO_COMMUNICATION; };
uint8_t getStatus(void) const { return _status; };
inline bool openCircuit() { return _status == STATUS_OPEN_CIRCUIT; };
inline bool shortToGND() { return _status == STATUS_SHORT_TO_GND; };
inline bool shortToVCC() { return _status == STATUS_SHORT_TO_VCC; };
inline bool genericError() { return _status == STATUS_ERROR; };
inline bool noRead() { return _status == STATUS_NOREAD; };
inline bool noCommunication() { return _status == STATUS_NO_COMMUNICATION; };
// use offset to calibrate the TC.
void setOffset(const float t) { _offset = t; };
float getOffset() const { return _offset; };
void setOffset(const float t) { _offset = t; };
float getOffset() const { return _offset; };
// set the above E_TC (etc) Seebeck Coefficients
// set the above E_TC or other Seebeck Coefficients
// one can also set your own optimized values.
void setSeebeckCoefficient(const float SC) { _SC = SC; };
float getSeebeckCoefficient() const { return _SC; };
void setSeebeckCoefficient(const float SC) { _SeebeckC = SC; };
float getSeebeckCoefficient() const { return _SeebeckC; };
uint32_t lastRead() { return _lastRead; };
uint32_t getRawData() { return _rawData;};
uint32_t lastRead() { return _lastTimeRead; };
uint32_t getRawData() { return _rawData;};
// speed in Hz
void setSPIspeed(uint32_t speed);
uint32_t getSPIspeed() { return _SPIspeed; };
// ESP32 specific
#if defined(ESP32)
void selectHSPI() { _useHSPI = true; };
void selectVSPI() { _useHSPI = false; };
bool usesHSPI() { return _useHSPI; };
bool usesVSPI() { return !_useHSPI; };
// to overrule ESP32 default hardware pins
void setGPIOpins(uint8_t clock, uint8_t miso, uint8_t mosi, uint8_t select);
#endif
private:
uint32_t _read();
uint8_t _status;
float _internal;
float _temperature;
float _offset;
float _SC;
uint32_t _lastRead;
float _SeebeckC;
uint32_t _lastTimeRead;
uint32_t _rawData;
bool _hwSPI;
uint8_t _sclk;
uint8_t _clock;
uint8_t _miso;
uint8_t _cs;
uint8_t _select;
uint32_t _SPIspeed = 1000000;
SPIClass * mySPI;
SPISettings _spi_settings;
#if defined(ESP32)
bool _useHSPI = true;
#endif
};

View File

@ -5,7 +5,9 @@
# MAX31855_RT
Arduino library for MAX31855 chip for K type thermocouple
Arduino library for MAX31855 chip for K type thermocouple.
The library has experimental support for other types of thermocouples E, J, N, R, S, T
## Description
@ -24,7 +26,7 @@ Library tested with breakout board
```
+---------+
Vin | o |
3Vo | o |
3V3 | o |
GND | o O | Thermocouple
D0 | o O | Thermocouple
CS | o |
@ -35,36 +37,62 @@ Library tested with breakout board
## Hardware SPI vs software SPI
Default pin connections (ESP32 has more options)
| HW SPI | UNO | ESP32 |
|:---------|:-----:|:-------:|
| CLOCKPIN | 13 | 18 |
| MISO | 12 | 19 |
| MOSI | 11 | 23 |
Default pin connections. ESP32 can overrule with **setGPIOpins()**.
| HW SPI | UNO | ESP32 VSPI | ESP32 HSPI | Notes
|:---------|:-----:|:-------:|:-------:|:----------|
| CLOCKPIN | 13 | 18 | 14 |
| MISO | 12 | 19 | 12 |
| MOSI | 11 | 23 | 13 | *not used...*
| SELECT | eg. 4 | 5 | 15 | *can be others too.*
Performance read() function, timing in us. (ESP32 @240MHz)
| mode | clock | timing UNO | timing ESP32 |
|:------|---------:|-----------:|-------------:|
| HWSPI | 32000000 | ni | ~15 |
| HWSPI | 16000000 | ~68 | ~16 |
| HWSPI | 4000000 | ~72 | ~23 |
| HWSPI | 1000000 | ~100 | ~51 |
| HWSPI | 500000 | ~128 | ~89 |
| SWSPI | bit bang | ~500 | ~17 (!) |
| mode | clock | timing UNO | timing ESP32 | Notes
|:-------|---------:|-----------:|-------------:|:----------|
| HW SPI | 32000000 | ni | ~15 | *less reliable*
| HW SPI | 16000000 | ~68 | ~16 |
| HW SPI | 4000000 | ~72 | ~23 |
| HW SPI | 1000000 | ~100 | ~51 |
| HW SPI | 500000 | ~128 | ~89 |
| SW SPI | bit bang | ~500 | ~17 (!) |
## Interface
To make a temperature reading call **tc.read()**.
### Constructor
- **MAX31855(const uint8_t select)** create object and set select pin => hardware SPI
- **MAX31855(const uint8_t sclk, const uint8_t select, const uint8_t miso)** create object, set clock, select and miso pin => software SPI
### Hardware SPI
To be used only if one needs a specific speed.
- **void setSPIspeed(uint32_t speed)** set SPI transfer rate
- **uint32_t getSPIspeed()** returns SPI transfer rate
### ESP32 specific
- **void selectHSPI()** must be called before **begin()**
- **void selectVSPI()** must be called before **begin()**
- **bool usesHSPI()**
- **bool usesVSPI()**
- **void setGPIOpins(uint8_t clk, uint8_t miso, uint8_t mosi, uint8_t select)** to overrule ESP32 default hardware pins
### Reading
To make a temperature reading call **read()**.
It returns the status of the read which is a value between 0..7
The function **getStatus()** returns the same status value.
Table: values returned from **read()** and **getStatus()**
Table: values returned from **uint8_t read()** and **uint8_t getStatus()**
| value | Description | Action |
|:-----:|:--------------------------|:-------------|
@ -79,23 +107,33 @@ Table: values returned from **read()** and **getStatus()**
There are six functions to check the individual error conditions mentioned above.
These make it easier to check them.
- **openCircuit()**
- **shortToGND()**
- **shortToVCC()**
- **genericError()**
- **noRead()**
- **noCommunication()**
- **bool openCircuit()**
- **bool shortToGND()**
- **bool shortToVCC()**
- **bool genericError()**
- **bool noRead()**
- **bool noCommunication()**
After a **tc.read()** you can get the temperature with **tc.getTemperature()**
and **tc.getInternal()** for the internal temperature of the chip / board itself.
After a **uint8_t read()** you can get the temperature with **float getTemperature()**
and **float getInternal()** for the internal temperature of the chip / board itself.
Normally these are (almost) equal.
Repeated calls to **tc.getTemperature()** will give the same value until a new **tc.read()**.
The latter fetches a new value from the sensor. Note that if the **tc.read()** fails
the value of **tc.getTemperature()** can become incorrect.
Repeated calls to **getTemperature()** will give the same value until a new **read()**.
The latter fetches a new value from the sensor. Note that if the **read()** fails
the value of **getTemperature()** can become incorrect. So it is important to check
the return value of **read()**.
### Offset
The library supports a fixed offset to calibrate the thermocouple.
For this the functions **tc.getOffset()** and **tc.setOffset(offset)** are available.
This offset is included in the **tc.getTemperature()** function.
For this the functions **float getOffset()** and **void setOffset(float offset)** are available.
This offset is "added" in the **getTemperature()** function.
Note the offset used is a float, so decimals can be used.
### Delta analysis
As the **tc** object holds its last known temperature it is easy to determine the delta
with the last known temperature, e.g. for trend analysis.
@ -111,7 +149,10 @@ with the last known temperature, e.g. for trend analysis.
}
```
The **tc** object keeps track of the last time **tc.read()** is called in the function **tc.lastRead()**.
### Last time read
The **tc** object keeps track of the last time **read()** is called in the function **uint32_t lastRead()**.
The time is tracked in **millis()**. This makes it easy to read the sensor at certain intervals.
```cpp
@ -131,10 +172,10 @@ if (millis() - tc.lastRead() >= interval)
```
## GetRawData
### GetRawData
The function **tc.getRawData()** allows you to get all the 32 bits raw data from the board,
after the standard **tc.read()** call.
The function **uint32_t getRawData()** allows you to get all the 32 bits raw data from the board,
after the standard **uint8_t tc.read()** call.
Example code can be found in the examples folder.
@ -143,6 +184,8 @@ Example code can be found in the examples folder.
uint32_t value = thermocouple.getRawData(); // Read the raw Data value from the module
```
This allows one to compact the measurement e.g. for storage or sending over a network.
## Pull Up Resistor
@ -186,6 +229,8 @@ See examples
## Experimental part (to be tested)
(to be tested)
**NOTE:**
The support for other thermocouples is experimental **use at your own risk**.
@ -219,11 +264,12 @@ thermocouple is connected.
Having that Vout we can redo the math for the actual thermocouple type and
calculate the real temperature.
The library has two functions **tc.setSeebeckCoefficient(factor)** and
**tc.getSeebeckCoefficient()**
The library has two functions **setSeebeckCoefficient(float factor)** and
**float getSeebeckCoefficient()**
to get/set the Seebeck Coefficient (== thermocouple) to be used.
One can adjust the values to improve the accuracy of the temperature read.
The **tc.getTemperature()** has implemented this algorithm, however as long
The **float getTemperature()** has implemented this algorithm, however as long
as one does not set the Seebeck Coefficient it will use the K_TC as default.

View File

@ -0,0 +1,7 @@
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
# - uno
# - leonardo
# - due
# - zero

View File

@ -0,0 +1,92 @@
//
// FILE: max31855_ESP32_HSPI.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: thermocouple lib demo application
// DATE: 2021-08-11
// URL: https://github.com/RobTillaart/MAX31855_RT
//
// NOTE:
// one might to need to disconnect pin 12 during upload of the code
// when HSPI is used.
#include "MAX31855.h"
// read() timing UNO timing ESP32 |
//---------------------------------------------
// HWSPI 16000000 ~68 us ~16 us
// HWSPI 4000000 ~72 us ~23 us
// HWSPI 1000000 ~100 us ~51 us
// HWSPI 500000 ~128 us ~89 us
// SWSPI bitbang ~500 us ~17 us
// | HW SPI | UNO | ESP32 | ESP32 |
// | | | VSPI | HSPI |
// |:---------|:-----:|:-------:|:-------:|
// | CLOCKPIN | 13 | 18 | 14 |
// | MISO | 12 | 19 | 12 |
// | MOSI | 11 | 23 | 13 | * not used...
// | SELECT | eg. 4 | 5 | 15 | * can be others too.
const int csPin = 15;
uint32_t start, stop;
MAX31855 tc(csPin);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("MAX31855_VERSION: ");
Serial.println(MAX31855_VERSION);
Serial.println();
tc.selectHSPI(); // needs to be called before begin()
tc.begin();
tc.setSPIspeed(16000000);
}
void loop()
{
start = micros();
int status = tc.read();
stop = micros();
Serial.println();
Serial.print("time:\t\t");
Serial.println(stop - start);
Serial.print("stat:\t\t");
Serial.println(status);
uint32_t raw = tc.getRawData();
Serial.print("raw:\t\t");
uint32_t mask = 0x80000000;
for (int i = 0; i < 32; i++)
{
if ((i > 0) && (i % 4 == 0)) Serial.print(" ");
Serial.print((raw & mask) ? 1 : 0);
mask >>= 1;
}
Serial.println();
float internal = tc.getInternal();
Serial.print("internal:\t");
Serial.println(internal, 3);
float temp = tc.getTemperature();
Serial.print("temperature:\t");
Serial.println(temp, 3);
delay(1000);
}
// -- END OF FILE --

View File

@ -0,0 +1,7 @@
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
# - uno
# - leonardo
# - due
# - zero

View File

@ -0,0 +1,90 @@
//
// FILE: max31855_ESP32_VSPI.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: thermocouple lib demo application
// DATE: 2021-08-11
// URL: https://github.com/RobTillaart/MAX31855_RT
//
#include "MAX31855.h"
// read() timing UNO timing ESP32 |
//---------------------------------------------
// HWSPI 16000000 ~68 us ~16 us
// HWSPI 4000000 ~72 us ~23 us
// HWSPI 1000000 ~100 us ~51 us
// HWSPI 500000 ~128 us ~89 us
// SWSPI bitbang ~500 us ~17 us
//
// | HW SPI | UNO | ESP32 | ESP32 |
// | | | VSPI | HSPI |
// |:---------|:-----:|:-------:|:-------:|
// | CLOCKPIN | 13 | 18 | 14 |
// | MISO | 12 | 19 | 12 |
// | MOSI | 11 | 23 | 13 | * not used...
// | SELECT | eg. 4 | 5 | 15 | * can be others too.
const int csPin = 15;
uint32_t start, stop;
MAX31855 tc(csPin);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("MAX31855_VERSION: ");
Serial.println(MAX31855_VERSION);
Serial.println();
tc.selectVSPI(); // needs to be called before begin()
tc.begin();
tc.setSPIspeed(16000000);
}
void loop()
{
start = micros();
int status = tc.read();
stop = micros();
Serial.println();
Serial.print("time:\t\t");
Serial.println(stop - start);
Serial.print("stat:\t\t");
Serial.println(status);
uint32_t raw = tc.getRawData();
Serial.print("raw:\t\t");
uint32_t mask = 0x80000000;
for (int i = 0; i < 32; i++)
{
if ((i > 0) && (i % 4 == 0)) Serial.print(" ");
Serial.print((raw & mask) ? 1 : 0);
mask >>= 1;
}
Serial.println();
float internal = tc.getInternal();
Serial.print("internal:\t");
Serial.println(internal, 3);
float temp = tc.getTemperature();
Serial.print("temperature:\t");
Serial.println(temp, 3);
delay(1000);
}
// -- END OF FILE --

View File

@ -16,7 +16,7 @@
// HWSPI 4000000 ~72 us ~23 us
// HWSPI 1000000 ~100 us ~51 us
// HWSPI 500000 ~128 us ~89 us
// SWSPI bitbang ~500 us ~
// SWSPI bitbang ~500 us ~17 us
//

View File

@ -0,0 +1,89 @@
//
// FILE: max31855_sw_SPI.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: thermocouple lib demo application
// DATE: 2021-08-11
// URL: https://github.com/RobTillaart/MAX31855_RT
//
#include "MAX31855.h"
// read() timing UNO timing ESP32 |
//---------------------------------------------
// HWSPI 16000000 ~68 us ~16 us
// HWSPI 4000000 ~72 us ~23 us
// HWSPI 1000000 ~100 us ~51 us
// HWSPI 500000 ~128 us ~89 us
// SWSPI bitbang ~500 us ~17 us
// | HW SPI | UNO | ESP32 | ESP32 |
// | | | VSPI | HSPI |
// |:---------|:-----:|:-------:|:-------:|
// | CLOCKPIN | 13 | 18 | 14 |
// | MISO | 12 | 19 | 12 |
// | MOSI | 11 | 23 | 13 | * not used...
// | SELECT | eg. 4 | 5 | 15 | * can be others too.
const int csPin = 15;
const int clkPin = 14;
const int dataPin = 12;
uint32_t start, stop;
MAX31855 tc(clkPin, csPin, dataPin); // sw SPI
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("Start max31855_demo0: ");
Serial.println(MAX31855_VERSION);
Serial.println();
tc.begin();
}
void loop()
{
start = micros();
int status = tc.read();
stop = micros();
Serial.println();
Serial.print("time:\t\t");
Serial.println(stop - start);
Serial.print("stat:\t\t");
Serial.println(status);
uint32_t raw = tc.getRawData();
Serial.print("raw:\t\t");
uint32_t mask = 0x80000000;
for (int i = 0; i < 32; i++)
{
if ((i > 0) && (i % 4 == 0)) Serial.print(" ");
Serial.print((raw & mask) ? 1 : 0);
mask >>= 1;
}
Serial.println();
float internal = tc.getInternal();
Serial.print("internal:\t");
Serial.println(internal, 3);
float temp = tc.getTemperature();
Serial.print("temperature:\t");
Serial.println(temp, 3);
delay(1000);
}
// -- END OF FILE --

View File

@ -27,6 +27,15 @@ getSeebeckCoefficient KEYWORD2
lastRead KEYWORD2
getRawData KEYWORD2
setSPIspeed KEYWORD2
getSPIspeed KEYWORD2
selectHSPI KEYWORD2
selectVSPI KEYWORD2
usesHSPI KEYWORD2
usesVSPI KEYWORD2
setGPIOpins KEYWORD2
# Instances (KEYWORD2)

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/MAX31855_RT"
},
"version": "0.2.5",
"version": "0.3.0",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"

View File

@ -1,5 +1,5 @@
name=MAX31855_RT
version=0.2.5
version=0.3.0
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for MAX31855 chip for K type thermocouple.