Why getTemperature() not work to libraries NTC?

Hi there!

I´m build station weather simple, but when write sintaxe temp.getTemperature() to any library to sensor NTC is refused.Why this it happens?
Someone help me please!

Thanks

Post your code, describe which libraries you use and describe your components and how things are wired and powered

Also explain what "refused" means.

Sounds like you made a mistake in your sketch or choice of library. If you post your sketch we might be able to help.

Hi there,

Follow below my sintaxe complete, but when I wrote Temperatura = temp.getTemperature(); appear these msg “request for member which is of non-class type int”

#include <AverageThermistor.h>
#include <NTC_Thermistor.h>
#include <SmoothThermistor.h>
#include <Thermistor.h>

#include <LiquidCrystal_I2C.h>
#include <Wire.h>

class LiquidCrystal_I2C lcd (0x27,20,4);
#define THERMISTOR 2
Thermistor temp (2);
int Buzzer = 12;
int vetorled={9,10};
int ADClido = 0; // conversor Analogico digital
float Temperatura ;
int temp;
void setup() {
pinMode(A2,INPUT);
pinMode(12,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
lcd.init();
lcd.setBacklight(HIGH);
Serial.begin(9600);
analogReference (DEFAULT);
delay(1000);
}

void loop() {
ADClido = analogRead(A2);
Temperatura = temp.getTemperature();
Serial.print(“Temperatura:”);
Serial.println(“C”);
delay(1000);
lcd.setCursor(0,0);
lcd.print(“Temp.”);
lcd.write(B11011111);
lcd.print(“C”);
if(Temperatura>25){
tone(12,20,1000);
delay(500);
noTone(12);
digitalWrite(10,HIGH);
digitalWrite(9,LOW);
}
else
{ digitalWrite(10,LOW);
digitalWrite(9,HIGH);
tone(12,60,1000);
delay(100);
digitalWrite(9,LOW);
delay(100);
digitalWrite(9,HIGH);
delay(500);

}

}

You are trying to use two global variables named 'temp':

Thermistor temp(2);
int temp;

That should cause an error by itself.

request for member which is of non-class type int

Interestingly, one temp is declared as int, and the other is declared as Thermistor which is of class type (and could have members).

Maybe this is can had being the cause of problema, but when I fix to it, still I am informed the error like "cannot declare variable “temp” to be of abstract type ‘Thermistor’.
I´m sorry if I do the questions few smart, but I´m just beggining,okay
Thanks!

Please provide a link to the library.

wilroberto:
"cannot declare variable "temp" to be of abstract type 'Thermistor'.

An 'abstract' type is an incomplete class that is intended to be the basis for a more complete class.
You should look at the examples provided with the library to see how to use it. If no examples are provided, look for some documentation. If neither exists you will have to look at the source code for the library to figure it out.

Guys,
Thank very much,
I intent look at more closer to learn about that.

Wilson

#define THERMISTOR 2
Thermistor temp (2);

should be

#define THERMISTOR 2
NTC_Thermistor temp (THERMISTOR);

or

#define THERMISTOR 2
Smooth_Thermistor temp (THERMISTOR);

or

#define THERMISTOR 2
AverageThermistor temp (THERMISTOR);

and try removing

#include <Thermistor.h>

Hello everyone,

After to chech up library reference that´s OK. Follow below the libraries complete:

"thermistor.h"

"HardwareSerial.h"

Regards

Wilson