Coop1 by TXMEDIC

This sketch is missing a short description
**void_coop_climate_control** **********pin assignments********** const int coop_fan_1 = const int coop_fan_2 = const int coop_heater = const int coop_heater_pump = const int coop_water_heater = const int coop_water_pump = const int left_window_closed_sensor = const int left_window_open_sensor = const int right_window_closed_sensor = const int right_window_open_sensor = **********setup********** pinMode(coop_fan_1, OUTPUT); digitalWrite(coop_fan_1, HIGH); pinMode(coop_fan_2, OUTPUT); digitalWrite(coop_fan_2, HIGH); pinMode(coop_heater, OUTPUT); digitalWrite(coop_heater, HIGH); pinMode(coop_heater_pump, OUTPUT); digitalWrite(coop_heater_pump, HIGH); pinMode(coop_water_heater, OUTPUT); digitalWrite(coop_water_heater, HIGH); pinMode(coop_water_pump, OUTPUT); digitalWrite(coop_water_pump, HIGH); pinMode(left_window_closed_sensor, INPUT); digitalWrite(left_window_closed_sensor, HIGH); pinMode(left_window_open_sensor, INPUT); digitalWrite(left_window_open_sensor, HIGH); pinMode(right_window_closed_sensor, INPUT); digitalWrite(right_window_closed_sensor, HIGH); pinMode(right_window_open_sensor, INPUT); digitalWrite(right_window_open_sensor, HIGH); void coop_climate_control() { if(coop_temp < 40) { digitalWrite(coop_heater, LOW); digitalWrite(coop_heater_pump, LOW); digitalWrite(coop_water_heater, LOW); digitalWrite(coop_water_pump, LOW); digitalWrite(coop_fan_1, HIGH); digitalWrote(coop_fan_2, HIGH); coop_window_close_control(); } if((coop_temp < 50) && (coop_temp <70)) { digitalWrite(coop_fan_1, HIGH); digitalWrite(coop_fan_2, HIGH); digitalWrite(coop_heater, HIGH); digitalWrite(coop_heater_pump, HIGH); digitalWrite(coop_water_heater, HIGH); coop_water_pump_control(); coop_window_open_control(); } if(coop_temp > 80) { digitalWrite(coop_heater, HIGH); digitalWrite(coop_heater_pump, HIGH); digitalWrite(coop_water_heater, HIGH); coop_fan_control(); coop_water_pump_control(); coop_window_open_control(); } coop_window_close() { left_window_closed_sensor_val = digitalRead(left_window_closed_sensor); left_window_open_sensor_val = digitalRead(left_window_open_sensor); right_window_closed_sensor_val = digitalRead(right_window_closed_sensor); right_window_open_sensor_val = digitalRead(right_window_open_sensor); digitalWrite(left_window_motor_close, LOW); digitalWrite(left_window_motor_open, HIGH); analogWrite(left_window_motor_enable, 255); if (left_window_closed_sensor_val == 0) { digitalWrite(left_window_motor_close, HIGH); digitalWrite(left_window_motor_open, HIGH); analogWrite(left_window_motor_enable, 0); } digitalWrite(right_window_motor_close, LOW); digitalWrite(right_window_motor_open, HIGH); analogWrite(right_window_motor_enable, 255); if (right_window_closed_sensor_val == 0) { digitalWrite(right_window_motor_close, HIGH); digitalWrite(right_window_motor_open, HIGH); analogWrite(right_window_motor_enable, 0); } } coop_window_open() { left_window_closed_sensor_val = digitalRead(left_window_closed_sensor); left_window_open_sensor_val = digitalRead(left_window_open_sensor); right_window_closed_sensor_val = digitalRead(right_window_closed_sensor); right_window_open_sensor_val = digitalRead(right_window_open_sensor); digitalWrite(left_window_motor_close, HIGH); digitalWrite(left_window_motor_open, LOW); analogWrite(left_window_motor_enable, 255); if (left_window_closed_sensor_val == 0) { digitalWrite(left_window_motor_close, HIGH); digitalWrite(left_window_motor_open, HIGH); analogWrite(left_window_motor_enable, 0); } digitalWrite(right_window_motor_close, HIGH); digitalWrite(right_window_motor_open, LOW); analogWrite(right_window_motor_enable, 255); if (right_window_closed_sensor_val == 0) { digitalWrite(right_window_motor_close, HIGH); digitalWrite(right_window_motor_open, HIGH); analogWrite(right_window_motor_enable, 0); } } coop_fan_control() { if (fanRelayRunning) { digitalWrite(useFanRelay1 ? fanRelay1 : fanRelay2, HIGH); fanRelayRunning = false; } useFanRelay1 = !useFanRelay1; lastFanRelayTime = millis(); if (!fanRelayRunning) { digitalWrite(useFanRelay1 ? fanRelay1 : fanRelay2, LOW); fanRelayRunning = true; } } coop_water_pump_control()

Embed This Sketch

Use the following HTML code to embed the sketch code above in your blog or website.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/sketch:158006" frameborder="0"></iframe>

Embed The Serial Monitor

You can also embed the Serial Monitor section! Just use this HTML code.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/serialmonitor" frameborder="0"></iframe>