This repository was archived by the owner on Jun 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSensorProcessing.h
More file actions
70 lines (61 loc) · 1.38 KB
/
Copy pathSensorProcessing.h
File metadata and controls
70 lines (61 loc) · 1.38 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
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
//Functions act as intermediaries between sensor value readouts and sensor usage
//Potentiometer value on lift
int liftHeight()
{
return ((SensorValue(rightPot)));
}
//Average drive encoder distance
int encoderDistance()
{
return ((abs(nMotorEncoder[driveLeft1])));
}
//Average Encoder DIstance for Use in Turning
int encoderTurnDistance()
{
return (abs(nMotorEncoder[driveLeft1]));
}
//Left Drive Encoder Distance
int leftEncoderDistance()
{
return -nMotorEncoder[driveLeft1];
}
//RIght Drive Encoder Distance
int rightEncoderDistance()
{
return nMotorEncoder[driveLeft1];
}
//Potentiometer Values for autonomous selection
int autoSelector()
{
if (SensorValue(leftPot) >= 32 && SensorValue(leftPot) < 934)
return 1;
else if (SensorValue(leftPot) >= 934 && SensorValue(leftPot) < 1587)
return 2;
else if (SensorValue(leftPot) >= 1587 && SensorValue(leftPot) < 2204)
return 3;
else if (SensorValue(leftPot) >= 2204 && SensorValue(leftPot) < 2970)
return 4;
else if (SensorValue(leftPot) >= 2970 && SensorValue(leftPot) < 4095)
return 5;
else
return 0;
}
bool buttonPressed()
{
if (SensorValue(leftSwitch) == 1)
return true;
else if (SensorValue(rightSwitch) == 1)
return true;
else if (SensorValue(frontSwitch) == 1)
return true;
else
return false;
}
bool rightButton()
{
return (SensorValue(rightSwitch));
}
bool leftButton()
{
return (SensorValue(leftSwitch));
}