Template
35 lines
1.0 KiB
C
35 lines
1.0 KiB
C
/* hot_water.h */
|
|
#ifndef HOT_WATER
|
|
#define HOT_WATER
|
|
|
|
#define SERIAL_DEBUGGING false
|
|
#define wait_for_serial true
|
|
|
|
#if (SERIAL_DEBUGGING)
|
|
// If SERIAL_DEBUGGING is defined, do Serial.print()
|
|
#define DPRINT(...) Serial.print(__VA_ARGS__)
|
|
#define DPRINTLN(...) Serial.println(__VA_ARGS__)
|
|
#if (wait_for_serial)
|
|
#define DBEGIN(...) Serial.begin(__VA_ARGS__);do{}while(!Serial)
|
|
#else // don't wait
|
|
#define DBEGIN(...) Serial.begin(__VA_ARGS__) // don't wait for serial
|
|
#endif
|
|
#else
|
|
// Otherwise, do nothing.
|
|
#define DPRINT(...) do{}while(false)
|
|
#define DPRINTLN(...) do{}while(false)
|
|
#define DBEGIN(...) do{}while(false)
|
|
#endif /* SERIAL_DEBUGGING */
|
|
|
|
#define RATE 10 // Hz == 100mS
|
|
|
|
// == water into the water heater = hot water demand when LOW
|
|
#define FLOW_PIN 11 // this is INT0
|
|
#define FLOWING (digitalRead(FLOW_PIN)==LOW)
|
|
#define NOTFLOWING (digitalRead(FLOW_PIN)==HIGH)
|
|
|
|
#define PUMP_PIN 12
|
|
#define PUMP_ON digitalWrite(PUMP_PIN,LOW)
|
|
#define PUMP_OFF digitalWrite(PUMP_PIN,HIGH)
|
|
|
|
#endif |