So recently we tried to test our robot, however the driver control code does not work, but the autonomous code does work. When we move the joystick, all we hear is a ticking sound and the base does not move in any direction. Our code is as follows
#pragma config(Sensor, in1, catasensor, sensorPotentiometer)
#pragma config(Motor, port1, motorBr, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor, port2, motorBr2, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor, port3, motorBr3, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor, port4, motorFr, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor, port7, motorBl, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor, port8, motorBl2, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor, port9, motorBl3, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor, port10, motorFl, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor, port5, motorMx, tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor, port6, motorIntake, tmotorVex393HighSpeed_MC29, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
/---------------------------------------------------------------------------/
/* /
/ Description: Competition template for VEX EDR /
/ /
/---------------------------------------------------------------------------*/
// This code is for the VEX cortex platform
#pragma platform(VEX2)
// Select Download method as “competition”
#pragma competitionControl(Competition)
//Main competition background code…do not modify!
#include “Vex_Competition_Includes.c”
void arcadethreshold(int threshold)
{
int X1 = 0;
int Y1 = 0;
if(abs(vexRT[Ch4])> threshold)
Y1 = vexRT[Ch4];
if(abs(vexRT[Ch3]) > threshold)
X1 = vexRT[Ch3];
if(X1 > 70)
X1 = 100;
if(X1 < -70)
X1 = -100;
if(Y1 > 70)
Y1 = 100;
if(Y1 < -70)
Y1 = -100;
motor[motorBl] = Y1 + X1;
motor[motorBl2] = Y1 + X1;
motor[motorBl3] = Y1 + X1;
motor[motorFl] = Y1 + X1;
motor[motorBr] = Y1 - X1;
motor[motorBr2] = Y1 - X1;
motor[motorBr3] = Y1 - X1;
motor[motorFr] = Y1 - X1;
//driver control
}
/---------------------------------------------------------------------------/
/* 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 /
/ or the autonomous and usercontrol tasks will not be started. This /
/ function is only called once after the cortex has been powered on and /
/ not every time that the robot is disabled. /
/---------------------------------------------------------------------------*/
void pre_auton()
{
// Set bStopTasksBetweenModes to false if you want to keep user created tasks
// running between Autonomous and Driver controlled modes. You will need to
// manage all user created tasks if set to false.
bStopTasksBetweenModes = true;
// Set bDisplayCompetitionStatusOnLcd to false if you don’t want the LCD
// used by the competition include file, for example, you might want
// to display your team name on the LCD in this function.
// bDisplayCompetitionStatusOnLcd = false;
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, …
}
/---------------------------------------------------------------------------/
/* /
/ 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. /
/---------------------------------------------------------------------------*/
task autonomous()
{
motor[motorBl] = 100;
motor[motorBl2] = 100;
motor[motorBl3] = 100;
motor[motorBr] = -100;
motor[motorBr2] = -100;
motor[motorBr3] = -100;
motor[motorFl] = 100;
motor[motorFr] = -100;
wait1Msec(1000);
motor[motorBl] = 0;
motor[motorBl2] = 0;
motor[motorBl3] = 0;
motor[motorBr] = 0;
motor[motorBr2] = 0;
motor[motorBr3] = 0;
motor[motorFl] = 0;
motor[motorFr] = 0;
wait1Msec(500);
motor[motorMx] = 120;
wait1Msec(100);
motor[motorBl] = 100;
motor[motorBl2] = 100;
motor[motorBl3] = 100;
motor[motorBr] = -100;
motor[motorBr2] = -100;
motor[motorBr3] = -100;
motor[motorFl] = 100;
motor[motorFr] = -100;
motor[motorIntake] = 120;
wait1Msec(76);
motor[motorFl] = 100;
motor[motorBl] = 100;
motor[motorBl2] = 100;
motor[motorBl3] = 100;
motor[motorFr] = 0;
motor[motorBr] = 0;
motor[motorBr2] = 0;
motor[motorBr3] = 0;
motor[motorIntake] = 100;
wait1Msec(100);
motor[motorBl] = 0;
motor[motorBl2] = 0;
motor[motorBl3] = 0;
motor[motorBr] = 0;
motor[motorBr2] = 0;
motor[motorBr3] = 0;
motor[motorFl] = 0;
motor[motorFr] = 0;
motor[motorIntake] = 0;
motor[motorMx] = 100;
wait1Msec(1000);
// autonomous
}
/---------------------------------------------------------------------------/
/* /
/ User Control Task /
/ /
/ 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. /
/---------------------------------------------------------------------------*/
task usercontrol()
{
// User control code here, inside the loop
while (true)
{
arcadethreshold(20);
if(SensorValue(sensorPotentiometer) >= 300)
if(vexRT[Btn6U] == 1)
{
motor[motorMx] = 120;
}
else
{
motor[motorMx] = 25;
}
//catapult with potentiometer
if(vexRT[Btn5U] == 1)
{
motor[motorIntake] = 120;
}
else if(vexRT[Btn5D] == 1)
{
motor[motorIntake] = -120;
}
else
{
motor[motorIntake] = 0;
}
// intake
if(vexRT[Btn8U] == 1)
{
motor[motorBl] = 100;
motor[motorBl2] = 100;
motor[motorBl3] = 100;
motor[motorBr] = -100;
motor[motorBr2] = -100;
motor[motorBr3] = -100;
motor[motorFl] = 100;
motor[motorFr] = -100;
wait1Msec(1000);
motor[motorBl] = 0;
motor[motorBl2] = 0;
motor[motorBl3] = 0;
motor[motorBr] = 0;
motor[motorBr2] = 0;
motor[motorBr3] = 0;
motor[motorFl] = 0;
motor[motorFr] = 0;
wait1Msec(500);
motor[motorMx] = 120;
wait1Msec(100);
motor[motorBl] = 100;
motor[motorBl2] = 100;
motor[motorBl3] = 100;
motor[motorBr] = -100;
motor[motorBr2] = -100;
motor[motorBr3] = -100;
motor[motorFl] = 100;
motor[motorFr] = -100;
motor[motorIntake] = 120;
wait1Msec(76);
motor[motorFl] = 100;
motor[motorBl] = 100;
motor[motorBl2] = 100;
motor[motorBl3] = 100;
motor[motorFr] = 0;
motor[motorBr] = 0;
motor[motorBr2] = 0;
motor[motorBr3] = 0;
}
else
{
motor[motorFl] = 0;
motor[motorBl] = 0;
motor[motorBl2] = 0;
motor[motorBl3] = 0;
motor[motorFr] = 0;
motor[motorBr] = 0;
motor[motorBr2] = 0;
motor[motorBr3] = 0;
motor[motorIntake] = 0;
motor[motorMx] = 0;
}
//assign autnomous function to a button
UserControlCodePlaceholderForTesting();
}
}
//P.S. The auton very quickly coded to test out the base