-
Notifications
You must be signed in to change notification settings - Fork 1
/
actuators.h
87 lines (72 loc) · 1.46 KB
/
actuators.h
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
#include <Servo.h>
// parachute and probe : servo
// landing legs and flag : motor
// onboard transistor : pin 5
#define probePin 28
#define probeDeployAngle 180
#define probeLockAngle 0
#define parachutePin 29
#define parachuteDeployAngle 90
#define parachuteLockAngle 0
#define flagPin 7
#define landinglegsPin 5
Servo probeServo;
Servo paraServo;
void actuatorSetup()
{
probeServo.attach(probePin);
paraServo.attach(parachutePin);
pinMode(flagPin,OUTPUT);
pinMode(landinglegsPin,OUTPUT);
}
void deployProbe()
{
// Turn servo to deploy probe
probeServo.write(probeDeployAngle);
return ;
}
void lockProbe()
{
// Turn servo to lock probe
probeServo.write(probeLockAngle);
return ;
}
void deployParachute()
{
// Turn servo to deploy prachute
PC_deployed = true ;
paraServo.write(parachuteDeployAngle);
return ;
}
void lockPrachute()
{
// Turn servo to lock prachute
paraServo.write(parachuteLockAngle);
return ;
}
void raiseFlag()
{
// Turn servo to raise flag
MAST_raised = true ;
digitalWrite(flagPin,HIGH);
return;
}
void stopRaisingFlag()
{
// Turn servo to raise flag
digitalWrite(flagPin,LOW);
return;
}
void deployHeatSheild()
{
// Turn motor ( Turn pin High )
HS_deployed = true ;
digitalWrite(landinglegsPin,HIGH);
return ;
}
void stopDeployingHeatSheild()
{
// Stop turning motor ( Turn pin Low )
digitalWrite(landinglegsPin,LOW);
return ;
}