-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfire.cpp
67 lines (50 loc) · 1.41 KB
/
fire.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "fire.h"
Fire::Fire()
{
}
void Fire::pins(int glowPlug, int oilSpray, int relayGlowPlug, int relayOilSpray )
{
pinMode(glowPlug, INPUT);
_glowPlug = glowPlug;
pinMode(oilSpray, INPUT);
_oilSpray = oilSpray;
_relayGlowPlug = relayGlowPlug;
_relayOilSpray = relayOilSpray;
}
void Fire::_testInputValues(int glow, int oil )
{
Serial.print("glow plug switch value ");
Serial.println(glow);
Serial.print("oil switch value");
Serial.println(oil);
};
void Fire::checkFireSwitch()
{
int glowPlugRadioValue = pulseInPlus(_glowPlug);
int oilSprayRadioValue = pulseInPlus(_oilSpray);
//_testInputValues(glowPlugRadioValue, oilSprayRadioValue);
_checkFireSwitchConditionals(glowPlugRadioValue, oilSprayRadioValue);
}
void Fire::_checkFireSwitchConditionals(int glowPlugRadioValue, int oilSprayRadioValue)
{
bool glowPlug_switchValue = returnSwitchValue(glowPlugRadioValue);
bool oilSpray_switchValue = returnSwitchValue(oilSprayRadioValue);
if (glowPlug_switchValue == true)
{
Serial.println("Glow plug Switch is on!");
turnOnOffRelay(_relayGlowPlug, 0);
}
else
{
Serial.println("Fire Switch is off!");
turnOnOffRelay(_relayGlowPlug, 1);
}
if(oilSpray_switchValue == true){
Serial.println("Oil Switch is on!");
turnOnOffRelay(_relayOilSpray, 0);
}
else{
Serial.println("Oil Switch is off!");
turnOnOffRelay(_relayOilSpray, 1);
}
}