GY-63_MS5611/libraries/MAX31855_RT/examples/Demo_getRawData/Demo_getRawData.ino

61 lines
1.1 KiB
Arduino
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: Demo_getRawData.ino
// AUTHOR: FabioBrondo
2021-12-09 14:42:42 -05:00
// VERSION: 0.4.0
2021-01-29 06:31:58 -05:00
// PURPOSE: thermocouple lib demo application
// DATE: 2020-08-24
// URL: https://github.com/RobTillaart/MAX31855_RT
//
2021-12-09 14:42:42 -05:00
2021-01-29 06:31:58 -05:00
#include <SPI.h>
#include <MAX31855.h>
2021-12-09 14:42:42 -05:00
2021-01-29 06:31:58 -05:00
#define MAXDO 7 // Defining the MISO pin
#define MAXCS 6 // Defining the CS pin
#define MAXCLK 5 // Defining the SCK pin
2021-12-09 14:42:42 -05:00
MAX31855 thermocouple;
2021-01-29 06:31:58 -05:00
void setup ()
{
Serial.begin(115200);
delay(250);
2021-12-09 14:42:42 -05:00
thermocouple.begin(MAXCLK, MAXCS, MAXDO);
2021-01-29 06:31:58 -05:00
}
void loop ()
{
int status = thermocouple.read();
if (status == STATUS_NO_COMMUNICATION)
{
Serial.println("NO COMMUNICATION");
}
uint32_t value = thermocouple.getRawData(); // Read the raw Data value from the module
Serial.print("RAW:\t");
2021-07-05 02:37:20 -04:00
// Display the raw data value in BIN format
uint32_t mask = 0x80000000;
for (int i = 0; i < 32; i++)
{
if ((i > 0) && (i % 4 == 0)) Serial.print("-");
Serial.print((value & mask) ? 1 : 0);
mask >>= 1;
}
Serial.println();
2021-01-29 06:31:58 -05:00
Serial.print("TMP:\t");
2021-07-05 02:37:20 -04:00
Serial.println(thermocouple.getTemperature(), 3);
2021-01-29 06:31:58 -05:00
delay(100);
}
2021-12-09 14:42:42 -05:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --
2021-12-09 14:42:42 -05:00