{"mode":"Blocks","workspace":"<xml xmlns=\"http://www.w3.org/1999/xhtml\"><variables><variable type=\"\" id=\"U`9aA+=)r+L1tzA.)-qi\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">myVariable</variable></variables><block type=\"v5_events_when_started\" id=\".NsXwU_L.OuU1l7Sho$F\" x=\"70\" y=\"110\"><next><block type=\"v5_motion_set_motor_velocity\" id=\"XV0Ftp#s8BFF!bN#!IM5\"><field name=\"MOTOR\">MogoLift</field><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"[u,mcwXKKR2V@NnAqqC%\"><field name=\"NUM\">100</field></shadow></value><next><block type=\"v5_drivetrain_set_drive_velocity\" id=\"TK8wE+$frr_E7(.)q8-y\"><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"S#9vo~P^{bOV5%BY~?)O\"><field name=\"NUM\">100</field></shadow></value><next><block type=\"v5_drivetrain_set_turn_velocity\" id=\"qe*(yC`AGT2lX+dC6s!z\"><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"Sl]UTk|*/VyH}SBfWy{:\"><field name=\"NUM\">50</field></shadow></value></block></next></block></next></block></next></block></xml>","rconfig":[{"port":[1,10,0],"name":"Drivetrain","customName":false,"deviceType":"Drivetrain","setting":{"type":"2-motor","wheelSize":"wheel4in","gear":"ratio18_1","gearRatio":"1:1","direction":"fwd","gyroType":"none","width":"295","unit":"mm","wheelbase":"40","wheelbaseUnit":"mm"},"triportSourcePort":null},{"port":[2,9],"name":"MogoLift","customName":true,"deviceType":"MotorGroup","setting":{"fwd":"forward","rev":"reverse","gear":"ratio18_1","motor_a_reversed":"false","motor_b_reversed":"true"},"triportSourcePort":22},{"port":[],"name":"Controller1","customName":false,"deviceType":"Controller","setting":{"left":"","leftDir":"false","right":"MogoLift","rightDir":"false","upDown":"","upDownDir":"false","xB":"","xBDir":"false","drive":"split","id":"primary"},"triportSourcePort":22}],"slot":0,"platform":"V5","sdkVersion":"","appVersion":"","fileFormat":"1.0.0","icon":"","cppStatus":"true","cpp":"// Make sure all required headers are included.\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n#include <string.h>\n\n\n#include \"vex.h\"\n\nusing namespace vex;\n\n// Brain should be defined by default\nbrain Brain;\n\n\n// START V5 MACROS\n#define waitUntil(condition)                                                   \\\n  do {                                                                         \\\n    wait(5, msec);                                                             \\\n  } while (!(condition))\n\n#define repeat(iterations)                                                     \\\n  for (int iterator = 0; iterator < iterations; iterator++)\n// END V5 MACROS\n\n\n// Robot configuration code.\nmotor LeftDriveSmart = motor(PORT1, ratio18_1, false);\nmotor RightDriveSmart = motor(PORT10, ratio18_1, true);\ndrivetrain Drivetrain = drivetrain(LeftDriveSmart, RightDriveSmart, 319.19, 295, 40, mm, 1);\n\nmotor MogoLiftMotorA = motor(PORT2, ratio18_1, false);\nmotor MogoLiftMotorB = motor(PORT9, ratio18_1, true);\nmotor_group MogoLift = motor_group(MogoLiftMotorA, MogoLiftMotorB);\n\ncontroller Controller1 = controller(primary);\n\n\n\n// Generated code.\n\n\n\n\n// define variable for remote controller enable/disable\nbool RemoteControlCodeEnabled = true;\n// define variables used for controlling motors based on controller inputs\nbool Controller1RightShoulderControlMotorsStopped = true;\nbool DrivetrainLNeedsToBeStopped_Controller1 = true;\nbool DrivetrainRNeedsToBeStopped_Controller1 = true;\n\n// define a task that will handle monitoring inputs from Controller1\nint rc_auto_loop_function_Controller1() {\n  // process the controller input every 20 milliseconds\n  // update the motors based on the input values\n  while(true) {\n    if(RemoteControlCodeEnabled) {\n      // calculate the drivetrain motor velocities from the controller joystick axies\n      // left = Axis3 + Axis1\n      // right = Axis3 - Axis1\n      int drivetrainLeftSideSpeed = Controller1.Axis3.position() + Controller1.Axis1.position();\n      int drivetrainRightSideSpeed = Controller1.Axis3.position() - Controller1.Axis1.position();\n      \n      // check if the value is inside of the deadband range\n      if (drivetrainLeftSideSpeed < 5 && drivetrainLeftSideSpeed > -5) {\n        // check if the left motor has already been stopped\n        if (DrivetrainLNeedsToBeStopped_Controller1) {\n          // stop the left drive motor\n          LeftDriveSmart.stop();\n          // tell the code that the left motor has been stopped\n          DrivetrainLNeedsToBeStopped_Controller1 = false;\n        }\n      } else {\n        // reset the toggle so that the deadband code knows to stop the left motor nexttime the input is in the deadband range\n        DrivetrainLNeedsToBeStopped_Controller1 = true;\n      }\n      // check if the value is inside of the deadband range\n      if (drivetrainRightSideSpeed < 5 && drivetrainRightSideSpeed > -5) {\n        // check if the right motor has already been stopped\n        if (DrivetrainRNeedsToBeStopped_Controller1) {\n          // stop the right drive motor\n          RightDriveSmart.stop();\n          // tell the code that the right motor has been stopped\n          DrivetrainRNeedsToBeStopped_Controller1 = false;\n        }\n      } else {\n        // reset the toggle so that the deadband code knows to stop the right motor next time the input is in the deadband range\n        DrivetrainRNeedsToBeStopped_Controller1 = true;\n      }\n      \n      // only tell the left drive motor to spin if the values are not in the deadband range\n      if (DrivetrainLNeedsToBeStopped_Controller1) {\n        LeftDriveSmart.setVelocity(drivetrainLeftSideSpeed, percent);\n        LeftDriveSmart.spin(forward);\n      }\n      // only tell the right drive motor to spin if the values are not in the deadband range\n      if (DrivetrainRNeedsToBeStopped_Controller1) {\n        RightDriveSmart.setVelocity(drivetrainRightSideSpeed, percent);\n        RightDriveSmart.spin(forward);\n      }\n      // check the ButtonR1/ButtonR2 status to control MogoLift\n      if (Controller1.ButtonR1.pressing()) {\n        MogoLift.spin(forward);\n        Controller1RightShoulderControlMotorsStopped = false;\n      } else if (Controller1.ButtonR2.pressing()) {\n        MogoLift.spin(reverse);\n        Controller1RightShoulderControlMotorsStopped = false;\n      } else if (!Controller1RightShoulderControlMotorsStopped) {\n        MogoLift.stop();\n        // set the toggle so that we don't constantly tell the motor to stop when the buttons are released\n        Controller1RightShoulderControlMotorsStopped = true;\n      }\n    }\n    // wait before repeating the process\n    wait(20, msec);\n  }\n  return 0;\n}\n\n\n// Include the V5 Library\n#include \"vex.h\"\n  \n// Allows for easier use of the VEX Library\nusing namespace vex;\n\nfloat myVariable;\n\n// \"when started\" hat block\nint whenStarted1() {\n  MogoLift.setVelocity(100.0, percent);\n  Drivetrain.setDriveVelocity(100.0, percent);\n  Drivetrain.setTurnVelocity(50.0, percent);\n  return 0;\n}\n\n\nint main() {\n  task rc_auto_loop_task_Controller1(rc_auto_loop_function_Controller1);\n\n  // post event registration\n\n  // set default print color to black\n  printf(\"\\033[30m\");\n\n  // wait for rotation sensor to fully initialize\n  wait(30, msec);\n\n  whenStarted1();\n}"}