Hi everyone, i have attached some code, this is designed to select 8 different autonomous routines from 4 bumpers and 1 limit switch … is there something i have done massively wrong as when i put code into it, it doesn’t work
thanks
Liam Grazier
#pragma config(UART_Usage, UART2, uartNotUsed, baudRate4800, IOPins, None, None)
#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, in1, pot1, sensorPotentiometer)
#pragma config(Sensor, dgtl1, auton1, sensorTouch)
#pragma config(Sensor, dgtl2, auton2, sensorTouch)
#pragma config(Sensor, dgtl3, auton3, sensorTouch)
#pragma config(Sensor, dgtl4, auton4, sensorTouch)
#pragma config(Sensor, dgtl5, set, sensorTouch)
#pragma config(Sensor, dgtl12, tester, sensorTouch)
#pragma config(Sensor, I2C_1, encoder1, sensorQuadEncoderOnI2CPort, , AutoAssign)
#pragma config(Sensor, I2C_2, encoder2, sensorQuadEncoderOnI2CPort, , AutoAssign)
#pragma config(Motor, port1, frontleftmotor, tmotorVex393, openLoop, reversed, encoder, encoderPort, None, 1000)
#pragma config(Motor, port2, backleftmotor, tmotorVex393, openLoop, encoder, encoderPort, I2C_1, 1000)
#pragma config(Motor, port3, backrightmotor, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port4, leftlift, tmotorVex393, openLoop)
#pragma config(Motor, port5, rightlift, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port6, leftintake, tmotorVex393, openLoop, encoder, encoderPort, I2C_2, 1000)
#pragma config(Motor, port7, rightintake, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port8, hanging1, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port9, hanging2, tmotorVex393, openLoop)
#pragma config(Motor, port10, frontrightmotor, tmotorVex393, openLoop, reversed, encoder, encoderPort, None, 1000)
#pragma platform(VEX)
//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(15)
#pragma userControlDuration(105)
#include "Vex_Competition_Includes.c" //Main competition background code...do not modify!
void pre_auton()
{
bStopTasksBetweenModes = true;
}
task autonomous()
{
int con1=0;
int con2=0;
int con3=0;
int con4=0;
int con5=0;
int con6=0;
int con7=0;
int con8=0;
if(SensorValue[auton1] == 1 && SensorValue[set] == 0)
{
con1 = 1;
}
if(SensorValue[auton2] == 1 && SensorValue[set] == 0)
{
con3 = 1;
}
if(SensorValue[auton3] == 1 && SensorValue[set] == 0)
{
con5 = 1;
}
if(SensorValue[auton4] == 1 && SensorValue[set] == 0)
{
con7 = 1;
}
if(SensorValue[set] == 1 && SensorValue[auton1] == 1)
{
con2 = 1;
}
if(SensorValue[set] == 1 && SensorValue[auton2] == 1)
{
con4 = 1;
}
if(SensorValue[set] == 1 && SensorValue[auton3] == 1)
{
con6 = 1;
}
if(SensorValue[set] == 1 && SensorValue[auton4] == 1)
{
con8 = 1;
}
while(con1 == 1)
{
//auton1
}
while(con2 == 1)
{
//auton2
}
while(con3 == 1)
{
//auton3
}
while(con4 == 1)
{
//auton4
}
while(con5 == 1)
{
//auton5
}
while(con6 == 1)
{
//auton6
}
while(con7 == 1)
{
//auton7
}
while(con8 == 1)
{
//auton8
}
}
task usercontrol()
{
while (true)
{
UserControlCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
}
}