Compilation error: expected constructor, destructor, or type conversion before ';' token

I am an absolute beginner in programming and have a project to read a PT100 with an Arduino Uno and an adafruit Max31865. The error is still there and I cant find my mistake. I thought it is in the used signs and not a logical problem. Below you can find my reduced code. Thank you all for helping.

#include <Adafruit_MAX31865.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h> //Arduino Uno: SDA=A4, SCL=A5
#include <SPI.h>
#include <Adafruit_SPIDevice.h>


// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF      430.0
#define RNOMINAL 100.0

LiquidCrystal_I2C lcd(0x27, 20,4); //Festlegung Art des Displays

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);


setup() 
{
  Serial.begin(115200);
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
  max.begin(MAX31865_2WIRE); 
  lcd.init(); //Im Setup wird der LCD gestartet 
  lcd.backlight(); //Hintergrundbeleuchtung einschalten (lcd.noBacklight(); schaltet die Beleuchtung aus).
}

void PrintDisplay() 
{
lcd.clear(); //erase previous content of display
lcd.setCursor(0, 0);
lcd.print("Temperature = "); 
lcd.setCursor(0, 1);
lcd.print(max.temperature(RNOMINAL, RREF));
}

void loop() 
{
  PrintDisplay();
  delay(1000);
}

Try posting your whole code.
The error sounds like you forgot to put a parameter in a function.

You left off void before setup()


setup() 
{
  Serial.begin(115200);
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
  max.begin(MAX31865_2WIRE); 
  lcd.init(); //Im Setup wird der LCD gestartet 
  lcd.backlight(); //Hintergrundbeleuchtung einschalten (lcd.noBacklight(); schaltet die Beleuchtung aus).
}
2 Likes

Can't believe I didn't notice that :open_mouth:

Good example of pretty unclear compiler hint...

Thank you so much. I was searching for so many brackets that I didn't see.

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