Skip to content

Commit 186a81a

Browse files
Update Literal Actual Program
1 parent f1c0705 commit 186a81a

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Literal Actual Program

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
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+
148
/*----------------------------------------------------------------------------*/
249
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
350
/* Open Source Software - may be modified and shared by FRC teams. The code */

0 commit comments

Comments
 (0)