31855 program won't compile

In attempting to compile this sketch from Rob Tillaart's library, it returns an error on the line I have commented. I see that others have used this sketch successfully. Is there an obvious cause of this error? I'm missing something but can't see it.

//
// FILE: Demo_getRawData.ino
// AUTHOR: FabioBrondo
// VERSION: 0.1.1
// PURPOSE: thermocouple lib demo application
// DATE: 2020-08-24
// URL: GitHub - RobTillaart/MAX31855_RT: Arduino library for MAX31855 chip for K type thermocouple
//

#include <SPI.h>
#include <MAX31855.h>

#define MAXDO 7 // Defining the MISO pin
#define MAXCS 6 // Defining the CS pin
#define MAXCLK 5 // Defining the SCK pin

*****THIS LINE causes 'does not name a type' error *****
MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

void setup ()
{
Serial.begin(115200);
delay(250);
thermocouple.begin();
}

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");

// 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();

Serial.print("TMP:\t");
Serial.println(thermocouple.getTemperature(), 3);

delay(100);
}

// -- END OF FILE --

Please start by reading this post:
How to get the best out of this forum - Using Arduino / Programming Questions - Arduino Forum

Then please modify your post with formatted code in code tags.
Also please copy the entire error from the IDE and post in tags as well.

Then people will be able to help you much easier.

Can you post the full compiler output?

I just installed the library using the Library Manager and wrote and compiled this without error. Perhaps you should double-check your library installation.

#include <SPI.h>
#include <MAX31855.h>

#define MAXDO 7 // Defining the MISO pin
#define MAXCS 6 // Defining the CS pin
#define MAXCLK 5 // Defining the SCK pin

MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

void setup()
{
    thermocouple.begin();
}

void loop()
{
    
}

Hi,
It compiles for me.
What model Arduino are you using.
Have you properly loaded the MAX31855 library through the Library manager?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.