I am trying to compare a temperature to a dew point so I can regulate a heater. The temperature is labelled OTA (another is EP) and the dew point ((DHT11.dewPointFast()*1.8+34)), DEC). On compile I get an error stating that I can't compare a pointer to an integer. The location of the issue is near the end of the code. Help?
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
#include <dht11.h>
#include <math.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
dht11 DHT11;
#define ONE_WIRE_BUS 3
#define DHT11PIN 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress OTA={0x28, 0x94, 0xBB, 0x60, 0x03, 0x00, 0x00, 0x38};
DeviceAddress EP={0x28, 0xFE, 0xF6, 0xB6, 0x03, 0x00, 0x00, 0x39};
void setup(void)
{
sensors.begin();
sensors.setResolution(OTA, 10);
sensors.setResolution(EP, 10);
lcd.begin(16,2);
lcd.clear();
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
lcd.print("XX");
} else {
lcd.print((int)(DallasTemperature::toFahrenheit(tempC)));
}
}
void loop(void)
{
//Serial.println("\n");
int chk = DHT11.read(DHT11PIN);
//Serial.print("Read sensor: ");
switch (chk)
{
case 0: Serial.println("OK"); break;
case -1: Serial.println("Checksum error"); break;
case -2: Serial.println("Time out error"); break;
default: Serial.println("Unknown error"); break;
}
delay(1000);
//Lcd display for ambient temp, humidity and dew point on line 1. Remote temps for OTA and EP on line 2.
lcd.setCursor(0,0);
lcd.print("T");
lcd.print((int)DHT11.fahrenheit(), DEC);
lcd.setCursor(5,0);
lcd.print("H");
lcd.print((int)((float)DHT11.humidity), DEC);
lcd.print("%");
lcd.setCursor(10,0);
lcd.print("Dew");
lcd.print((int)((DHT11.dewPointFast()*1.8+32)), DEC);
sensors.requestTemperatures();
lcd.setCursor(0,1);
lcd.print("OTA ");
printTemperature(OTA);
lcd.print(" ");
lcd.setCursor(9,1);
lcd.print("EP ");
printTemperature(EP);
lcd.print(" ");
//Compare OTA and EP temp to Dew Point Temp. If the temps are less than 2 degrees above dew point, turn on the heaters on pins 5 and 6
{
if (OTA <= ((int)((DHT11.dewPointFast()*1.8+34)), DEC))
{
digitalWrite(5, HIGH); //if eyepiece temp is equal to or less than the dew point plus 2 degrees turn pin 5 on
}
else
{
digitalWrite(5, LOW); //if eyepiece tep is greater than the dew point plus 2 degrees turn pin 6 off
}
}
{
if (EP <= ((int)((DHT11.dewPointFast()*1.8+34)), DEC))
{
digitalWrite(6, HIGH); //if eyepiece temp is equal to or less than the dew point plus 2 degrees turn pin 6 on
}
else
{
digitalWrite(6, LOW); //if eyepiece temp is greater than the dew point plus 2 degrees turn pin 6 off
}
}
delay(1000);
}