-
Notifications
You must be signed in to change notification settings - Fork 0
/
KombatWombat_VEX.c
52 lines (42 loc) · 1.52 KB
/
KombatWombat_VEX.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
#pragma config(Motor, port1, harvester_2, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, left_drive, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, right_drive, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, launch_motor_1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, launch_motor_2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, claw_roll, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, top_lift, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, bottom_lift, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port9, claw_pitch, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, harvester_1, tmotorVex393_HBridge, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
//Defines
#define clamp(v)((v)>1)?1:((v)<-1)?-1:(v)
#define lift_up_btn Btn6U
#define lift_down_btn Btn6D
//Variables
int max_power = 127;
int assignPower = 0;
int button = false;
//set lift motors
void set_lift_motors_speed(int power){
assignPower = power;
motor[top_lift] = power;
motor[bottom_lift] = power;
}
task main()
{
while (true)
{
bool up_btn = (bool)vexRT[lift_up_btn];
bool down_btn = (bool)vexRT[lift_down_btn];
if(up_btn){
set_lift_motors_speed(127);
}
else if(down_btn){
set_lift_motors_speed(-127);
}
else{
set_lift_motors_speed(0);
}
}
}