File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ bool prevState = false;
2
+ bool currState = false;
3
+ bool driveTankMode = false;
4
+
5
+ while (IsOperatorControl())
6
+ {
7
+ //
8
+ // Check for button 6 press.
9
+ //
10
+ currState = secondaryController->GetRawButton(6);
11
+ if (currState != prevState)
12
+ {
13
+ if (currState)
14
+ {
15
+ //
16
+ // Button has been pressed.
17
+ //
18
+ driveTankMode = !driveTankMode;
19
+ }
20
+ else
21
+ {
22
+ //
23
+ // Button has been released.
24
+ //
25
+ }
26
+ prevState = currState;
27
+ }
28
+
29
+ if (driveTankMode)
30
+ {
31
+ //
32
+ // Do tank drive.
33
+ //
34
+ }
35
+ else
36
+ {
37
+ //
38
+ // Do arcade drive.
39
+ //
40
+ }
41
+
42
+ wait(0.02);
43
+ }
44
+
45
+
46
+
47
+
1
48
/*----------------------------------------------------------------------------*/
2
49
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
3
50
/* Open Source Software - may be modified and shared by FRC teams. The code */
You can’t perform that action at this time.
0 commit comments