code problems?

can anyone help me with problems i might have with this code

#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, dgtl1, touch, sensorTouch)
#pragma config(Sensor, I2C_1, fly1Eval, sensorQuadEncoderOnI2CPort, , AutoAssign)
#pragma config(Sensor, I2C_2, fly2Eval, sensorQuadEncoderOnI2CPort, , AutoAssign)
#pragma config(Motor, port1, intake, tmotorVex393HighSpeed_HBridge, openLoop, reversed)
#pragma config(Motor, port2, fly1, tmotorVex393HighSpeed_MC29, openLoop, encoderPort, I2C_1)
#pragma config(Motor, port3, d1, tmotorVex393HighSpeed_MC29, openLoop, reversed)
#pragma config(Motor, port4, d3, tmotorVex393HighSpeed_MC29, openLoop, reversed)
#pragma config(Motor, port5, d2, tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor, port6, d4, tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor, port9, fly2, tmotorVex393HighSpeed_MC29, openLoop, reversed, encoderPort, I2C_2)
#pragma config(Motor, port10, intake2, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(UART_Usage, UART2, uartVEXLCD, baudRate19200, IOPins, None, None)
#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include “Vex_Competition_Includes.c” //Main competition background code…do not modify!

double distance;
double leftencoder = 0;
double rightencoder = 0;
double encoderavg1 = 0;
double encoderavg2 = 0;
double eps = 0;
double rpm = 0;
double time = 0;

void pre_auton()
{
// Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
// Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.
bStopTasksBetweenModes = true;
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, …
}
task autonomous()
{
{
motor[fly1] = 80;
motor[fly2] = 80;
motor[d1] = -70;
motor[d2] = -70;
motor[d3] = -70;
motor[d4] = -70;
distance = distance + 1;
}
motor[d1] = -100;
motor[d2] = -100;
motor[d3] = -100;
motor[d4] = -100;
wait1Msec(300);
distance = distance / 2;
motor[d1] = 0;
motor[d2] = 0;
motor[d3] = 0;
motor[d4] = 0;
wait1Msec(300);
motor[intake] = 50;
motor[intake2] = 50;
motor[fly1] = 80;
motor[fly2] = 80;
wait1Msec(5000);
motor[fly1] = 0;
motor[fly2] = 0;
motor[intake] = 0;
motor[intake2] = 0;
{
motor[d1] = 100;
motor[d2] = 100;
motor[d3] = 100;
motor[d4] = 100;
distance = distance - 1;
}
motor[d1] = 0;
motor[d2] = 0;
motor[d3] = 0;
motor[d4] = 0;
}

task usercontrol()
{
SensorValue[fly1Eval] = 0;
SensorValue[fly2Eval] = 0;

while (true)
{
	//paste here for computer

	motor[d1] = vexRT[Ch2];
	motor[d3] = vexRT[Ch2];
	motor[d2] = vexRT[Ch3];
	motor[d4] = vexRT[Ch3];

	if(vexRT[Btn6U] == 1)
	{
	//paste here for controller
	//change variables here
	int motorspeed = 80; //motorspeed
	int refreshrate = 35; //refreshrate in seconds

	motor[fly1] =motorspeed;
	motor[fly2] =motorspeed;
	double targetrpm = 5300; //rpm target
	leftencoder = abs(SensorValue[fly1Eval]);
	rightencoder = abs(SensorValue[fly2Eval]);
	encoderavg1 = (leftencoder + rightencoder)/2;	 
	delay(refreshrate); 
	leftencoder = abs(SensorValue[fly1Eval]);
	rightencoder = abs(SensorValue[fly2Eval]);
	encoderavg2 = (leftencoder + rightencoder)/2;
	eps = encoderavg2 - encoderavg1;
	rpm = (eps/10)*60*28.57;

	if (rpm>=targetrpm){
	motor[fly1] =motorspeed;
	motor[fly2] =motorspeed;
	}
	else if (rpm<targetrpm){
	motor[fly1] =127;
	motor[fly2] =127;
	}
	}

	if(vexRT[Btn6D] == 1)
	{
	motor[fly1] = 127;
	motor[fly2] = 127;
	}

	if(vexRT[Btn6U] == 0 && vexRT[Btn6D]==0)
	{
	motor[fly1] = 0;
	motor[fly2] = 0;
	}

	if(vexRT[Btn5U] == 1)
	{
	motor[intake] = 100;
	motor[intake2] = -100;
	}

	if(vexRT[Btn5D] == 1)
	{
	motor[intake] = -127;
	motor[intake2] = 127;

	}

	if(vexRT[Btn5U] == 0 && vexRT[Btn5D] ==0)
	{
	motor[intake] = 0;
	motor[intake2] = 0;
	}
	
}

}

Is there a specific problem with the code? If there is, you might want to describe the problem so that we can diagnose it.

Or are you just looking for basic syntax proofreading?

The lcd and the bang bang program is the main problems but having someone else proofread everything else would be great aswell

And i want the lcd to display the battery boltages of both my batterys

For starters, RobotC doesn’t support the use of doubles. Those global variables should be defined as floats.

So what’s the problem with your bang bang problem exactly?
Does it not maintain rpm well enough, not spin up fast enough, etc.?

It seems like bang bang doesent spin upfast enough after shooting a ball alwo coulf yoy ehow me hoe to program the lcd so it displays battery voltages

Well by definition bang bang has to spin up the fastest of any type of velocity control. Maybe it doesn’t stabilize as much as you would like? If it’s honestly spin up time than maybe there is too much friction or too high or a gear ratio.

Also for LCD check out http://www.robotc.net/blog/2012/05/18/advanced-applications-with-the-vex-lcd/

Ok thanks