'if/else' statement not working. wont switch to "cooling"

  if (val = 1)

Why are you assigning a value of 1 to val in an if statement?