-
Notifications
You must be signed in to change notification settings - Fork 18
/
OxiKit_Final_Arduino_Code_v2.ino
134 lines (107 loc) · 4.41 KB
/
OxiKit_Final_Arduino_Code_v2.ino
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Full program for Arduino Uno control of Oxycon Relays and LCD units.
// Edited: 05/11/20
// Author: Robert Danger Byrd
// For Version 5 AKA "Handy Oxy"
// RELAY PIN ASSIGNMENT
//**************************************************************************
int Sieve_A_Valve = 5; //Defined Pin as Variable
int Sieve_B_Valve = 6; //Defined Pin as Variable
int PreCharge_Valve = 7; //Defined Pin as Variable
int Fan = 8; //Defined Pin as Variable
// VARIABLE CREATION
//**************************************************************************
unsigned long Relay_Test_Delay; //delay variable creation
unsigned long Startup_Purge_Delay; //delay variable creation
unsigned long Production_Delay; //delay variable creation
unsigned long Flush_Delay; //delay variable creation
unsigned long PreCharge_Delay; //delay variable creation
//**************************************************************************
void setup()
{
// STARTUP
//**************************************************************************
// Serial Port initialization
Serial.begin(9600);
// SET PIN MODE FOR PINS IN PROGRAM
//**************************************************************************
pinMode(Sieve_A_Valve, OUTPUT);
pinMode(Sieve_B_Valve, OUTPUT);
pinMode(PreCharge_Valve, OUTPUT);
pinMode(Fan, OUTPUT);
// SET DELAY TIMING HERE
//**************************************************************************
Relay_Test_Delay = 0;
Startup_Purge_Delay = 1000;
Production_Delay = 4000;
Flush_Delay = 450;
PreCharge_Delay = 700;
// VALVE RELAY TEST SEQUENCE
//**************************************************************************
Serial.println("Relay Test Sequence");
digitalWrite(Sieve_A_Valve, HIGH); //Turn on relay
delay(Relay_Test_Delay);
digitalWrite(Sieve_B_Valve, HIGH); //Turn on relay
delay(Relay_Test_Delay);
digitalWrite(PreCharge_Valve, HIGH); //Turn on relay
delay(Relay_Test_Delay);
Serial.println("Valve Relay Test Sequence Complete");
delay(Relay_Test_Delay);
// STARTUP PURGE
//**************************************************************************
Serial.println("Relay Test Sequence");
digitalWrite(Sieve_A_Valve, HIGH); //Turn on relay
digitalWrite(Sieve_B_Valve, HIGH); //Turn on relay
digitalWrite(PreCharge_Valve, HIGH); //Turn on relay
delay(Startup_Purge_Delay);
// FAN CONTROL
//**************************************************************************
Serial.println("Program Starting...");
delay(Relay_Test_Delay);
digitalWrite(Fan, HIGH);
Serial.println("Fan Switched On");
}
void loop()
{
//CYCLE 1
//**************************************************************************
Serial.println("Sieve A Charge / Sieve B Purge");
digitalWrite(Sieve_A_Valve, HIGH);
digitalWrite(Sieve_B_Valve, LOW);
digitalWrite(PreCharge_Valve, LOW);
delay(Production_Delay);
//CYCLE 2
//**************************************************************************
Serial.println("Sieve A Charge / Sieve B Purge / Flush/PreCharge");
digitalWrite(Sieve_A_Valve, HIGH);
digitalWrite(Sieve_B_Valve, LOW);
digitalWrite(PreCharge_Valve, HIGH);
delay(Flush_Delay) ;
//CYCLE 3
//**************************************************************************
Serial.println("Sieve A Charge / Sieve B Charge / Flush/PreCharge");
digitalWrite(Sieve_A_Valve, HIGH);
digitalWrite(Sieve_B_Valve, HIGH);
digitalWrite(PreCharge_Valve, HIGH);
delay(PreCharge_Delay);
//CYCLE 4
//**************************************************************************
Serial.println("Sieve A Purge / Sieve B Charge");
digitalWrite(Sieve_A_Valve, LOW);
digitalWrite(Sieve_B_Valve, HIGH);
digitalWrite(PreCharge_Valve, LOW);
delay(Production_Delay);
//CYCLE 5
//**************************************************************************
Serial.println("Sieve A Purge / Sieve B Charge / Flush/PreCharge");
digitalWrite(Sieve_A_Valve, LOW);
digitalWrite(Sieve_B_Valve, HIGH);
digitalWrite(PreCharge_Valve, HIGH);
delay(Flush_Delay);
//CYCLE 6
//**************************************************************************
Serial.println("Sieve A Charge / Sieve B Charge / Flush/PreCharge");
digitalWrite(Sieve_A_Valve, HIGH);
digitalWrite(Sieve_B_Valve, HIGH);
digitalWrite(PreCharge_Valve, HIGH);
delay(PreCharge_Delay) ;
}