-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path2024_03_07-lamp_outlet_and_degassing_sketch.ino
More file actions
37 lines (30 loc) · 1.23 KB
/
2024_03_07-lamp_outlet_and_degassing_sketch.ino
File metadata and controls
37 lines (30 loc) · 1.23 KB
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
const int PIN_RELAY_DEGASS = 8; //definition of GPIO pin for switching relay connected to degassing valve
const int PIN_RELAY_LAMP_OUTLET = 9; //definition of GPIO pin for switching relay connected to USB connection of master/slave outlet
bool isOn = false;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(PIN_RELAY_DEGASS, OUTPUT);
pinMode(PIN_RELAY_LAMP_OUTLET, OUTPUT);
digitalWrite(PIN_RELAY_LAMP_OUTLET, HIGH); //lamp outlet turned off
digitalWrite(PIN_RELAY_DEGASS, HIGH); //degassing valve turned off
}
void loop() {
// put your main code here, to run repeatedly:
// if a paket of information is available at the serial port read it
if (Serial.available() > 0) {
String msg = Serial.readString();
if (msg == "1") {
digitalWrite(PIN_RELAY_DEGASS, LOW); //turn degassing valve on
}
if (msg =="0") {
digitalWrite(PIN_RELAY_DEGASS, HIGH); //turn degassing valve off
}
if (msg == "ON") {
digitalWrite(PIN_RELAY_LAMP_OUTLET, LOW); //turn USB port on --> also turns outlet on
}
if (msg=="OFF") {
digitalWrite(PIN_RELAY_LAMP_OUTLET, HIGH); //turn USB port off --> also turns outlet off
}
}
}