forked from bitdog-io/restraining_bolt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServoRelay.cpp
More file actions
44 lines (36 loc) · 796 Bytes
/
Copy pathServoRelay.cpp
File metadata and controls
44 lines (36 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
//
//
#include "ServoRelay.h"
#include <ArduinoLog.h>
constexpr int POWER_SYSTEM_RELAY_PIN = 33;
constexpr int ALARM_RELAY_PIN = 36;
constexpr int ON = 180;
constexpr int OFF = 0;
ServoRelay::ServoRelay()
{
_pwmPowerSystemRelay.attach( POWER_SYSTEM_RELAY_PIN,900,2200 );
_pwmPowerSystemRelay.attach( ALARM_RELAY_PIN,900,2200 );
alarmRelayOff();
powerRelayOff();
}
void ServoRelay::powerRelayOff()
{
Log.trace( "Turning off power" );
_pwmPowerSystemRelay.write( OFF );
}
void ServoRelay::powerRelayOn()
{
Log.trace( "Turning on power" );
_pwmPowerSystemRelay.write( ON );
}
void ServoRelay::alarmRelayOff()
{
Log.trace( "Turning off alarm" );
_pwmAlarmRelay.write( OFF );
}
void ServoRelay::alarmRelayOn()
{
Log.trace( "Turning on alarm" );
_pwmAlarmRelay.write( ON );
}