Download the file
  1. #include "relay.h"
  2. #include "heater_controller_slave.h"
  3.  
  4. Relay::Relay():
  5. state(RELAY_OPEN),
  6. port(RELAY_PORT)
  7. {
  8. port.mode(OUTPUT);
  9. port.digiWrite(LOW);
  10. }
  11.  
  12. void Relay::close() {
  13. port.digiWrite(HIGH);
  14. state = RELAY_CLOSED;
  15. }
  16.  
  17. void Relay::open() {
  18. port.digiWrite(LOW);
  19. state = RELAY_OPEN;
  20. }
  21.  
  22. uint8_t Relay::get_state() {
  23. return state;
  24. }
  25. // vim:ft=arduino
  26.  
  27.