forked from Victinil/Robots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutoA that probably works
85 lines (57 loc) · 2.36 KB
/
AutoA that probably works
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
82
83
84
/*----------------------------------------------------------------------------*/
/* */
/* Module: main.cpp */
/* Author: niedererfamily */
/* Created: Sat Nov 23 2019 */
/* Description: V5 project */
/* */
/*----------------------------------------------------------------------------*/
// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// IntakeRight motor 19
// IntakeLeft motor 20
// IntakeArmTiltLeft motor 17
// BlockRampTilt motor 5
// IntakeArmTiltRight motor 18
// FrontBump bumper A
// BackBump bumper B
// Drivetrain drivetrain 1, 10
// Controller1 controller
// ---- END VEXCODE CONFIGURED DEVICES ----
#include "vex.h"
using namespace vex;
int senseTouch() {
int count = 0;
bool(blockTouch) = FrontBump.pressing();
while(1<2){
if(blockTouch){
Drivetrain.setDriveVelocity(20,percent);
IntakeLeft.spinFor(0.5,turns);
IntakeRight.spinFor(0.5,turns);
Drivetrain.setDriveVelocity(75,percent);
}
vex::task::sleep(25);
}
return(0);
}
// this code senses if the robot is touching a block
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
int count = 0;
vex::task t(senseTouch);
IntakeArmTiltRight.spinFor(0.05,turns);
IntakeArmTiltLeft.spinFor(-0.05,turns);
bool(blockTouch) = FrontBump.pressing();
Drivetrain.setDriveVelocity(75,percent);
// these are the base settings
Drivetrain.driveFor(48,inches);
Drivetrain.turnFor(-90,degrees);
Drivetrain.driveFor(20,inches);
Drivetrain.turnFor(-90,degrees);
Drivetrain.driveFor(36,inches);
BlockRampTilt.spinToPosition(0,degrees);
Drivetrain.driveFor(-5,inches);
vex::task::sleep(10);
}