Hi
I have been having problems with my auto code i want 4 autos pretty much 2 for each side and i have a ultrasonic sensor to check which side is left and right and a pot to control which version of auto i want. i honestly have no clue what i am doing wrong so can u show me how to fix it so i can learn for next time.
I haven’t actually made the auto but i just don’t know how to fix the errors.
#pragma config(Sensor, in8, autonc, sensorPotentiometer)
#pragma config(Sensor, dgtl2, ad, sensorTouch)
#pragma config(Sensor, dgtl4, autons, sensorTouch)
#pragma config(Sensor, dgtl5, ultra, sensorSONAR_inch)
#pragma config(Sensor, dgtl10, claw, sensorDigitalOut)
#pragma config(Sensor, dgtl11, au, sensorTouch)
#pragma config(Sensor, dgtl12, solenoid, sensorDigitalOut)
#pragma config(Motor, port2, a1, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port3, a2, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port4, a3, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, d2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, d1, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port7, a4, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, a5, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, a6, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#pragma platform(VEX)
//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)
#include "Vex_Competition_Includes.c"
void pre_auton() {
// Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
// Autonomous and Tele-Op modes.
bStopTasksBetweenModes = true;
}
task autonomous() {
if(SensorValue(autonc)<=500)
{//fence stars
{if(SensorValue(ultra)>=48)
//do the fence stars on the right side
}else{
//do the fence stars on the right side
}
} else {
//field stars
{if(SensorValue(ultra)>=48)
//do the field stars on the right side
} else {
//Do the field stars on the left side
}
}
}
task usercontrol() {
while(true)
{
if(vexRT[Btn8L] == 1)
{
SensorValue[solenoid] = 1;
}
if(vexRT[Btn8L] == 0)
{
SensorValue[solenoid] = 0;
}
if(vexRT[Btn6D]==0)
{
SensorValue[claw]=1;
}
if(vexRT[Btn6D]==1)
{
SensorValue[claw]=0;
}
// Set drive motors
setMultipleMotors(vexRT[Ch2], d1);
setMultipleMotors(vexRT[Ch3], d2);
// Loop while robot's upper sensor is pressed in (add in pneumatic pistons when we get some)
if(SensorValue(au)) {
SensorValue[solenoid] = 1;
// Stop all motors
setMultipleMotors(0, a1, a2, a3, a4,);
setMultipleMotors(0, a5, a6,);
sleep(200);
setMultipleMotors(-50, a1, a2, a3,);
setMultipleMotors(-50, a4, a5, a6,);
sleep(100);
// If button 6U (upper right shoulder button) is pressed, active solenoid
//SensorValue[solenoid] = vexRT[Btn8D];
} else {
// If B5U is pressed, motors gets set to full forward speed
// If B5D is pressed, motors get set to full backward speed
setMultipleMotors((vexRT[Btn5U] - vexRT[Btn5D]) * 100, a1, a2, a3, a4,);
setMultipleMotors((vexRT[Btn5U] - vexRT[Btn5D]) * 100, a5, a6,);
//setMultipleMotors((vexRT[Btn7L] - vexRT[Btn7R]) * 127, a1, a2, a3, a4,);
//setMultipleMotors((vexRT[Btn7L] - vexRT[Btn7R]) * 127, a5, a6,);
}
sleep(20);
}
}