code problem

Implement different operation modes in your sketch (you will probably want an off mode too). Then decide how you want to tell your Arduino what mode to use. You might need some hysteresis in your temperature control.

if (mode == HEAT) {
  // do whatever to implement heat mode
}
else if (mode == COOL) {
  // do whatever to implement cool mode
}