1

I can't compare for the condition Error "sensors not int type" translate to int type does not work. Please tell me the solution to this problem

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

#define ONE_WIRE_BUS 2 
#define Rele 5

OneWire oneWire(ONE_WIRE_BUS); 
LiquidCrystal_I2C lcd(0x27,16,2); 
DallasTemperature sensors(&oneWire);

int tmp; 
int PotenciometrPin = A0; 
int val;

void setup(void) 
{ 
 pinMode(Rele, OUTPUT); 
 digitalWrite(Rele, HIGH); 

 lcd.init(); 
 lcd.backlight();
} 
 
void loop(void) 
{ 
 lcd.setCursor(0, 0); 
 sensors.requestTemperatures(); 
 val = analogRead(PotenciometrPin); 
 lcd.print("Ustonovit`: "); 
 val = map(val, 0, 1023, 0, 100); 
 lcd.print(val); 
 int(sensor); 
 // if(val = sensors){ <-- THIS PROBLEM
 //digitalWrite(Rele, LOW); 
 // } 
 lcd.setCursor(0, 1); 
 lcd.print("Fakt: "); 
 lcd.print(sensors.getTempCByIndex(0));
 delay(1000); 
}
jsotola
  • 1,249
  • 2
  • 10
  • 18
  • 1
    What is this supposed to do? `sensors` is an object, you cannot compare it to a value. What are you trying to compare it to? Besides, it should be `==`, not `=` for a comparison. And the line above the if is also useless. – PMF Mar 13 '21 at 08:22
  • Just look at the examples provided with that library (and look carefully at both the actual use and the setup parts). – Mat Mar 13 '21 at 17:14

0 Answers0