forked from HannahGuo/VEXPython2019
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.py
61 lines (50 loc) · 1.57 KB
/
Main.py
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
# VEX EDR Python-Project
import sys
import vex
#region config
left = vex.Motor(1)
flywheelLeft = vex.Motor(2)
rampIntake = vex.Motor(3)
flyWheelRight = vex.Motor(4)
intakeWheels = vex.Motor(6)
right = vex.Motor(10)
joystick = vex.Joystick()
timer = 0
enableHighFlywheelTimer = False
highFlywheelBuildUpTimer = 0
enableLowFlywheelTimer = False
lowFlywheelBuildUpTimer = 0
#endregion config
while True:
timer += 0.0022
straight = joystick.axis3()
steering = joystick.axis1()
left.run(-straight + steering)
right.run(straight + steering)
# print(timer)
if(joystick.b6up()): # high speed flywheel
if(not enableHighFlywheelTimer):
enableHighFlywheelTimer = True
highFlywheelBuildUpTimer = timer
flywheelLeft.run(-100)
flyWheelRight.run(100)
if(timer - highFlywheelBuildUpTimer > 2.8):
rampIntake.run(-100)
elif(joystick.b6down()): # low speed flywheel
if(not enableLowFlywheelTimer):
enableLowFlywheelTimer = True
lowFlywheelBuildUpTimer = timer
flywheelLeft.run(-70)
flyWheelRight.run(70)
if(timer - lowFlywheelBuildUpTimer > 2.8):
rampIntake.run(-100)
elif(joystick.b8down()):
rampIntake.run(-80)
intakeWheels.run(-50)
else:
rampIntake.run(0)
intakeWheels.run(0)
flywheelLeft.run(0)
flyWheelRight.run(0)
enableHighFlywheelTimer = False
enableLowFlywheelTimer = False