-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadjustbot.c
79 lines (66 loc) · 1.61 KB
/
adjustbot.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
#pragma config(Sensor, dgtl1, pnuematic, sensorDigitalOut)
#pragma config(Sensor, dgtl3, trigger, sensorTouch)
#pragma config(Sensor, dgtl10, downswitch, sensorTouch)
#pragma config(Sensor, dgtl11, upswitch, sensorTouch)
#pragma config(Motor, port7, motor2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, motor1, tmotorVex393_MC29, openLoop, reversed)
#pragma config(DatalogSeries, 0, "", Motors, MotorPower, port1, 50)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#pragma DebuggerWindows("Motors")
#pragma DebuggerWindows("VexLCD")
#pragma DebuggerWindows("taskStatus")
#pragma DebuggerWindows("debugStream")
#pragma DebuggerWindows("systemParameters")
#define shooter motor[port8]=motor[port1] // Keep the two motors in sync
void shooter_down (int speed)
{
shooter = speed;
while(!SensorValue[downswitch])
{
}
shooter = 0;
}
void shooter_down (int speed,int msec)
{
shooter = speed;
wait1Msec(msec);
shooter = 0;
}
void shooter_up (int speed)
{
shooter = speed * -1;
while(!SensorValue[upswitch])
{
}
shooter = 0;
}
void shooter_up (int speed, int msec)
{
shooter = speed*-1;
wait1Msec(msec);
shooter = 0;
}
void flip_pnu()
{
SensorValue[pnuematic] = !SensorValue[pnuematic];
writeDebugStreamLine("pnuematic state = %d",SensorValue[pnuematic]);
}
void set_pnu(int state)
{
SensorValue[pnuematic] = state;
}
string s;
task main()
{
set_pnu(1);
shooter_up(64);
wait1Msec(500);
flip_pnu();
shooter_down(64);
wait1Msec(100);
while(SensorValue[trigger] == 0)
{
}
shooter = 2;
flip_pnu();
}