Download the file
  1. #ifndef RELAY_CONTROLLER_H
  2. #define RELAY_CONTROLLER_H
  3.  
  4. #define SENSORS_PORT 3
  5. #define RELAY_PORT 4
  6.  
  7. #include <HardwareSerial.h>
  8.  
  9. extern HardwareSerial Serial;
  10.  
  11. #define BUFFER_LEN 12
  12.  
  13. #define SLAVE_ID 1
  14. #define MASTER_ID 2
  15. #define HEATER_GROUP 43
  16.  
  17. #define SEND_RETRY_COUNT 3
  18. #define SEND_RETRY_TIMEOUT 3000
  19.  
  20. #define SHOW_BUFFER(tag, hdr, buf, len) \
  21. Serial.print(tag); \
  22. if (hdr & RF12_HDR_CTL) Serial.print("CTL "); \
  23. if (hdr & RF12_HDR_DST) Serial.print("DST "); \
  24. if (hdr & RF12_HDR_ACK) Serial.print("ACK "); \
  25. Serial.print(hdr & RF12_HDR_MASK, DEC); \
  26. Serial.print(" [ "); \
  27.  for (int i=0; i<len; i++) { \
  28.   Serial.print(buf[i], HEX); Serial.print(" "); \
  29. } \
  30. Serial.println("]")
  31.  
  32. #define NB_ELEMENTS(a) sizeof(a) / sizeof(a[0])
  33.  
  34. #endif
  35. // vim:ft=arduino
  36.