MICS-VZ-89TE Library error

Hi,
I am trying to use the MICS-VZ-89TE CO2 sensor with an Arduino NANO 33 IOT. When I try to call any of the functions from its library (GitHub - HGrabas/MICS-VZ-89TE: Arduino library to read the MICS-VZ-89TE sensor) I recieve the following error:

"request for member 'readSensor' in 'CO2SENSOR', which is of non-class type 'MICS_VZ_89TE()' "

is there a problem with the library or did I do something wrong?

I declared my library object as follows:

MICS_VZ_89TE CO2SENSOR();

Samuel43:
Hi,
I am trying to use the MICS-VZ-89TE CO2 sensor with an Arduino NANO 33 IOT. When I try to call any of the functions from its library (GitHub - HGrabas/MICS-VZ-89TE: Arduino library to read the MICS-VZ-89TE sensor) I recieve the following error:

"request for member ‘readSensor’ in ‘CO2SENSOR’, which is of non-class type ‘MICS_VZ_89TE()’ "

is there a problem with the library or did I do something wrong?

I declared my library object as follows:

MICS_VZ_89TE CO2SENSOR();

remove the () and it compiles fine.

something like this:
(compiles, NOT tested!):

#include "MICS-VZ-89TE.h"

MICS_VZ_89TE CO2SENSOR;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  CO2SENSOR.begin();

  Serial.println("MICS-VZ-89TE Example");

}

void loop() { // run over and over

  CO2SENSOR.readSensor();

  float co2 = CO2SENSOR.getCO2();
  float voc = CO2SENSOR.getVOC();

  Serial.print("CO2: ");
  Serial.println(co2, 3);

  Serial.print("VOC: ");
  Serial.println(voc, 3);

  delay(1000);
}

hope that helps…

MICS-VZ-89TE_example.zip (2.32 KB)

Okay,
Thanks

To further explain, this:

Samuel43:
I declared my library object as follows:

MICS_VZ_89TE CO2SENSOR();

Does not define an object of the MICS_VZ_89TE class named CO2SENSOR. It's actually a prototype for a function named CO2SENSOR that takes no arguments and returns an object of the MICS_VZ_89TE class. As noted, removing the "()" pair corrects this error.