Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
h"
/*---------------------------------------------------------------------------*/
/* */
/* */
/*---------------------------------------------------------------------------*/
vex::competition Competition;
/*---------------------------------------------------------------------------*/
/* Pre-Autonomous Functions */
/* */
/* You may want to perform some actions before the competition starts. */
/* Do them in the following function. You must return from this function */
/* function is only called once after the cortex has been powered on and */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* */
/* Autonomous Task */
/* */
/* This task is used to control your robot during the autonomous phase of */
/* a VEX Competition. */
/* */
/* You must modify the code to add your own robot specific commands here. */
/*---------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* */
/* */
/* This task is used to control your robot during the user control phase of */
/* a VEX Competition. */
/* */
/* You must modify the code to add your own robot specific commands here. */
/*----------------------------------------------------------------------------*/
while (1){
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
//drive
Strafe.spin(vex::directionType::fwd, (Controller1.Axis4.value()+Controller1.Axis1.value())/2,
vex::velocityUnits::pct);
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//intake
if(Controller1.ButtonX.pressing()){
Intake.stop(brakeType::hold);
else if(Controller1.ButtonB.pressing()){
Intake.spin(directionType::rev, 60,vex::velocityUnits::pct);
else{
Intake.spin(directionType::fwd, 75,vex::velocityUnits::pct);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
if(Controller1.ButtonR1.pressing()){
Cube.spin(directionType::fwd, 50,vex::velocityUnits::pct);
else{
Cube.stop(brakeType::coast);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
////
//Extender
if(Controller1.ButtonUp.pressing()){
Extend.spin(directionType::fwd, 50,vex::velocityUnits::pct);
else if(Controller1.ButtonDown.pressing()){
Extend.spin(directionType::rev, 60,vex::velocityUnits::pct);
else{
Extend.stop(brakeType::hold);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//lift
if(Controller1.ButtonL1.pressing()){
Rlift.spin(directionType::fwd, 100,vex::velocityUnits::pct);
Llift.spin(directionType::fwd, 100,vex::velocityUnits::pct);
else if(Controller1.ButtonL2.pressing()){
Rlift.spin(directionType::rev, 100,vex::velocityUnits::pct);
Llift.spin(directionType::rev, 100,vex::velocityUnits::pct);
else{
Rlift.stop(brakeType::hold);
Llift.stop(brakeType::hold);
}
vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources.
//
//
int main() {
pre_auton();
Competition.autonomous( autonomous );
Competition.drivercontrol( usercontrol );
while(1) {
vex::task::sleep(100);//Sleep the task for a short amount of time to prevent wasted resources.