I’ve been programming this. it creates really nice turns with a gyroscope but I keep getting these errors: variable has incomplete type ’ void’ (25,6) and expected ‘;’ after top level declarator (25,43) can you please help me thankyou.
here is my code:
// Include the IQ Library
#include “iq_cpp.h”
// Allows for easier use of the VEX Library
using namespace vex;
int error;
int output;
int input;
int Distance;
int Heading;
int Velocity;
int Kp;
void Turn(Distance, Heading, Velocity, Kp) {
leftMotor.spinToPosition(0, degrees);
RightMotor.spinToPosition(0, degrees);
if(Velocity > 0){
while(leftMotor.position(degrees) < Distance){
error = Heading - Gyro.rotation();
output = error * Kp
leftMotor.setVelocity(Velocity - output, percent);
rightMotor.setVelocity(Velocity + output, percent);
leftMotor.spin(forward);
rightMotor.spin(forward);
}
}
else {
while(leftMotor.position(degrees) > Distance){
error = Heading - Gyro.rotation();
output = error - kp
leftMotor.setVelocity(Velocity - output, percent);
rightMotor.setVelocity(Velocity + output, percent);
leftMotor.spin(forward);
rightMotor.spin(forward);
}
}
leftMotor.stop();
rightMotor.stop();
}