-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUserInputExample.c
executable file
·81 lines (77 loc) · 1.79 KB
/
UserInputExample.c
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
#define START_RED "Red"
#define START_BLUE "Blue"
#define START_INSIDE "Inside"
#define START_OUTSIDE "Outside"
#define PARK_BACK "Back"
#define PARK_FRONT "Front"
string startColor;
string startPosition;
bool startPause = false;
string robotPark;
string bBallPark;
void getUserInput()
{
//disableDiagnosticsDisplay();
nxtDisplayCenteredTextLine(0, "Red or Blue?");
nxtDisplayCenteredTextLine(7, "Red Blue");
while(true)
{
if(nNxtButtonPressed == 2)
{
startColor = START_RED;
nxtDisplayCenteredTextLine(0, "Red");
break;
}
else if(nNxtButtonPressed == 1)
{
startColor = START_BLUE;
nxtDisplayCenteredTextLine(0, "Blue");
break;
}
}
PlaySound(soundBlip);
wait1Msec(1000);
nxtDisplayCenteredTextLine(1, "Inside or Outside?");
nxtDisplayCenteredTextLine(7, "Inside Outside");
while(true)
{
if(nNxtButtonPressed == 2)
{
startPosition = START_INSIDE;
nxtDisplayCenteredTextLine(1, "Inside");
break;
}
else if(nNxtButtonPressed == 1)
{
startPosition = START_OUTSIDE;
nxtDisplayCenteredTextLine(1, "Outside");
break;
}
}
PlaySound(soundBlip);
wait1Msec(1000);
nxtDisplayCenteredTextLine(2, "Wait 5 Seconds?");
nxtDisplayCenteredTextLine(7, "Yes No");
while(true)
{
if(nNxtButtonPressed == 2)
{
startPause = true;
nxtDisplayCenteredTextLine(2, "5s Wait: Yes");
break;
}
else if(nNxtButtonPressed == 1)
{
startPause = false;
nxtDisplayCenteredTextLine(2, "5s Wait: No");
break;
}
}
nxtDisplayTextLine(7, "");
PlaySound(soundBlip);
nxtDisplayCenteredTextLine(7, "* Tally ho! *");
}
task main()
{
getUserInput();
}