HI all. I am wondering how to wrap things in code
text well. I do it for a huge amount of code, and it doesnt work. Does anyone know how to do this?
ex:This
Summary
/ *----------------------------------------------------------------------------* /
/* <em>/
/</em> Module: main.cpp <em>/
/</em> Author: VEX <em>/
/</em> Created: Thu Sep 26 2019 <em>/
/</em> Description: Competition Template <em>/
/</em> <em>/
/</em> ----------------------------------------------------------------------------*/
// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// Drivetrain drivetrain 20, 11
// Controller1 controller
// ---- END VEXCODE CONFIGURED DEVICES ----
#include “vex.h”
using namespace vex;
// A global instance of competition
competition Competition;
// defining motors
// define your global instances of motors and other devices here
vex::motor Left(vex::PORT11, vex::gearSetting::ratio18_1,true);
vex::motor Right(vex::PORT20, vex::gearSetting::ratio18_1,false);
vex::motor LeftLift(vex::PORT1, vex::gearSetting::ratio36_1,true);
vex::motor RightLift(vex::PORT10, vex::gearSetting::ratio36_1,false);
vex::motor SecondLift(vex::PORT13, vex::gearSetting::ratio36_1,false);
vex::motor LeftClaw(vex::PORT2, vex::gearSetting::ratio18_1,true);
vex::motor RightClaw(vex::PORT7, vex::gearSetting::ratio18_1,false);
vex::controller con(vex::controllerType::primary);
/ *---------------------------------------------------------------------------* /
/* Pre-Autonomous Functions <em>/
/</em> <em>/
/</em> You may want to perform some actions before the competition starts. <em>/
/</em> Do them in the following function. You must return from this function <em>/
/</em> or the autonomous and usercontrol tasks will not be started. This <em>/
/</em> function is only called once after the V5 has been powered on and <em>/
/</em> not every time that the robot is disabled. <em>/
/</em> ---------------------------------------------------------------------------*/
void pre_auton(void) {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, …
}
/ *---------------------------------------------------------------------------* /
/* <em>/
/</em> Autonomous Task <em>/
/</em> <em>/
/</em> This task is used to control your robot during the autonomous phase of <em>/
/</em> a VEX Competition. <em>/
/</em> <em>/
/</em> You must modify the code to add your own robot specific commands here. <em>/
/</em> ---------------------------------------------------------------------------*/
void autonomous(void) {
Left.spin(reverse);
Right.spin(reverse);
LeftLift.spin(reverse);
RightLift.spin(reverse);
wait(1, sec);
LeftClaw.spin(forward);
RightClaw.spin(forward);
wait(4, sec);
LeftClaw.stop();
RightClaw.stop();
wait(5, sec);
Left.spin(forward);
Right.spin(forward);
wait(2, sec);
LeftLift.stop();
RightLift.stop();
Left.stop();
Right.stop();
}
/ *---------------------------------------------------------------------------* /
/* <em>/
/</em> User Control Task <em>/
/</em> <em>/
/</em> This task is used to control your robot during the user control phase of <em>/
/</em> a VEX Competition. <em>/
/</em> <em>/
/</em> You must modify the code to add your own robot specific commands here. <em>/
/</em> ---------------------------------------------------------------------------*/
void usercontrol(void) {
int LeftLiftSpeedPCT = 90;
int RightLiftSpeedPCT = 90;
int LeftClawSpeedPCT = 100;
int RightClawSpeedPCT = 100;
// User control code here, inside the loop
///Button Y up pri lift
while (1) {
if(con.ButtonY.pressing()) {
RightLift.spin(directionType::rev, RightClawSpeedPCT, velocityUnits::pct);
}
else if (con.ButtonY.pressing()) {
RightLift.spin(directionType::fwd, RightClawSpeedPCT, velocityUnits::pct);
}
else{
RightLift.stop(brakeType::brake);
}
if(con.ButtonY.pressing()) {
LeftLift.spin(directionType::rev, LeftClawSpeedPCT, velocityUnits::pct);
}
else if (con.ButtonY.pressing()) {
LeftLift.spin(directionType::fwd, LeftClawSpeedPCT, velocityUnits::pct);
}
else{
LeftLift.stop(brakeType::brake);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
//
/////////////////////////////////////////////////////////////////////////////////////////////////////
while (1) {
if(con.ButtonRight.pressing()) {
RightLift.spin(directionType::fwd, RightClawSpeedPCT, velocityUnits::pct);
}
else if (con.ButtonRight.pressing()) {
RightLift.spin(directionType::rev, RightClawSpeedPCT, velocityUnits::pct);
}
else{
RightLift.stop(brakeType::brake);
}
if(con.ButtonRight.pressing()) {
LeftLift.spin(directionType::fwd, LeftClawSpeedPCT, velocityUnits::pct);
}
else if (con.ButtonRight.pressing()) {
LeftLift.spin(directionType::rev, LeftClawSpeedPCT, velocityUnits::pct);
}
else{
LeftLift.stop(brakeType::brake);
}
//////////////
if(con.ButtonL1.pressing()) {
SecondLift.spin(directionType::fwd, LeftLiftSpeedPCT, velocityUnits::pct);
}
else if (con.ButtonL2.pressing()) {
SecondLift.spin(directionType::fwd, LeftLiftSpeedPCT, velocityUnits::pct);
}
else{
SecondLift.stop(brakeType::brake);
}
if(con.ButtonR1.pressing()) {
RightClaw.spin(directionType::rev, RightClawSpeedPCT, velocityUnits::pct);
}
else if (con.ButtonR2.pressing()) {
RightClaw.spin(directionType::fwd, RightClawSpeedPCT, velocityUnits::pct);
}
else{
RightClaw.stop(brakeType::brake);
}
if(con.ButtonR1.pressing()) {
LeftClaw.spin(directionType::rev, LeftClawSpeedPCT, velocityUnits::pct);
}
else if (con.ButtonR2.pressing()) {
LeftClaw.spin(directionType::fwd, LeftClawSpeedPCT, velocityUnits::pct);
}
else{
LeftClaw.stop(brakeType::brake);
}
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
// values based on feedback from the joysticks.
// …
// Insert user code here. This is where you use the joystick values to
// update your motors, etc.
// …
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}
//
// Main will set up the competition functions and callbacks.
//
int main() {
// Set up callbacks for autonomous and driver control periods.
Competition.autonomous(autonomous);
Competition.drivercontrol(usercontrol);
// Run the pre-autonomous function.
pre_auton();
// Prevent main from exiting with an infinite loop.
while (true) {
wait(100, msec);
}
}