Automated humidifier code

Hey guys, I have a sketch that I put together here to control my humidifier with Arduino, a Powerswitch Tail 2 (powerswitch tail 2 is a relay), and a DHT11 which is a temperature and humidity sensor. The output of the sensor will display on a 16*2 LCD.

I’m not a programming expert so I wanted to post my code here and get some feedback. The code compiles and everything but if anybody can take the time to look at the code and tell me if the last VOID PART is good enough for my powerswitch to turn on /off my humidifier that would be great. I don’t have my powerswitch yet otherwise I would test it out myself but in the meantime I thought I would consult anybody here that’s good with programming.

Anyways, guys read my code and let me know what you think.

#include "DHT.h"
#include <LiquidCrystal.h>
#define DHTPIN 8   
#define DHTTYPE DHT11 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
float tempF = 0.0;
int poweroutlet = 13;
void setup() {
  pinMode(poweroutlet, OUTPUT);
  digitalWrite(poweroutlet, LOW);
lcd.begin(16, 2);
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
tempF = ((t) * 9/5)+32;
if (isnan(t) || isnan(h)) {
  Serial.println("Failed to read from DHT");
else {
  lcd.print(" F");
  lcd.print("% ");
void powerSwitch(float data) {
float h = dht.readHumidity ();
  if (h < 31) {
    digitalWrite(poweroutlet, HIGH);
  else if (h > 50) {
    digitalWrite(poweroutlet, LOW);
  else (37<h>44); {
    digitalWrite(poweroutlet, LOW);

What’s this bit all about. I think you’ll find it’s totally redundant.

  else (37<h>44); {
    digitalWrite(poweroutlet, LOW);

You don't need the powerswitch to test your logic - do you have an LED to use instead?

As to the bizarre else clause at the end of the function, it's going to ensure that the powerswitch is always low - as KenF suggests, get rid of it.

where is powerswitch function call. i am not getting it??