#include "vex.h"

using namespace vex;
// Store the positions we are interested in as constants
const int pos1 = 80;
const int pos2 = 360;

// Declare Contoller event callbacks.
void preset1() {
  // Send motor to the preset
  Motor.rotateTo(pos1, rotationUnits::deg, false);
  // Wait until L1 is released.
  waitUntil(!Controller1.ButtonL1.pressing());
}
void preset2() {
  // Send motor to the preset
  Motor.rotateTo(pos2, rotationUnits::deg, false);
  // Wait until L1 is released.
  waitUntil(!Controller1.ButtonL1.pressing());
}

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Initialize the Contoller Events
  Controller1.ButtonL1.pressed(preset1);
  Controller1.ButtonL2.pressed(preset2);

  // Set the brake mode and velocity of the motor
  Motor.setStopping(hold);
  Motor.setVelocity(30, percent);

  // Set the current motor position as zero at the beginning of the program
  Motor.setPosition(0, degrees);

  while (true) {
    // drive code here

    // any other non button based code can be placed here
    wait(25, msec);
  }
}