test
This commit is contained in:
parent
a6f9370747
commit
eb1a420979
46
firmware/pump_simple.ino
Normal file
46
firmware/pump_simple.ino
Normal file
@ -0,0 +1,46 @@
|
||||
#define pressure_Aport 0
|
||||
#define relay_Dport 5
|
||||
|
||||
|
||||
|
||||
int pressure;
|
||||
int pressure_min = 180;
|
||||
int pressure_max = 350;
|
||||
bool flag;
|
||||
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
pinMode(relay_Dport, OUTPUT);
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
pressure = analogRead(pressure_Aport);
|
||||
Serial.println(pressure);
|
||||
|
||||
if (pressure < pressure_min) {
|
||||
if (!flag) {
|
||||
digitalWrite(relay_Dport, HIGH);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if (pressure > pressure_max) {
|
||||
if (flag) {
|
||||
digitalWrite(relay_Dport, LOW);
|
||||
flag = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
BIN
scheme.jpg
BIN
scheme.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 406 KiB |
Loading…
x
Reference in New Issue
Block a user