-
Notifications
You must be signed in to change notification settings - Fork 0
/
breathing_test.ino
60 lines (44 loc) · 1.2 KB
/
breathing_test.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
//**********************************************************************
//*** SOft SOcial RObotic Actuator Control With Arduino Motor Shield ***
//*** SOSORO - Breathing Test ***
//*** Ines Benomar ***
//**********************************************************************
//Pumps and valves initiated
int pumpPin1 = 5; //Pump 1
int valvePin1 = 10; //valve 1
bool breathsOn=1;
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
deflateComplete(); //Deflates the robot before
Serial.println("Beginning...");
}
void loop() {
runAll();
}
void runAll() {
if (breathsOn==1){
digitalWrite(pumpPin1,HIGH);
digitalWrite(valvePin1,HIGH);
delay(3400);
digitalWrite(pumpPin1,LOW);
digitalWrite(valvePin1,LOW);
delay(4400);
}
}
//Declaration of pump and valve functions below:
void inflate1(){
digitalWrite(pumpPin1,HIGH);
digitalWrite(valvePin1,HIGH);
}
void deflate1(){
digitalWrite(pumpPin1,LOW);
digitalWrite(valvePin1,LOW);
}
void hold1(){
digitalWrite(pumpPin1,LOW);
digitalWrite(valvePin1,HIGH);
}
void deflateComplete() {
deflate1();
delay(5000);
}