# I keep getting errors and some I cannot understand

I am building an arcade drive robot and I cannot figure out what my errors are. I am a bit of a noob, but I know enough to write a code and some basic debugging. Each time I fix an error, I run into a new one. here’s the code:

``````void setup(int x, int y); //make joystick arcade style controller

int powY;
int powX;
int powRightMotor;
int powLeftMotor;
int powmotordriveright;
int powmotordriveleft;

void loop()
{
// convert joystick -128 to 127 range to -100 to 100 for powering motors
powY = (y * 100) / 127; //joystick y axis gives maximum power level
powX = (x * 100) / 127; //x axis determines which motor is reduced or
//reversed for a turn

if (powX < 0) //if x negative, turning left; otherwise, turning right

powLeftMotor = (powY * (100 + (2 * powX))/100); //left motor reduced for right turn
powRightMotor = (powY * -(100 + (2 * powX))/100); //right motor is reversed

else

powRightMotor = (powY * (100 - (2 * powX))/100); //right motor reduced for left turn
powLeftMotor = (powY * -(100 + (2 * powX))/100); //left motor reversed

powRightMotor = powmotordriveright;
powLeftMotor = powmotordriveleft;
}
``````

here are the current errors:
MOTOR.ino: In function ‘void loop()’:
MOTOR:13: error: ‘y’ was not declared in this scope
MOTOR:14: error: ‘x’ was not declared in this scope
MOTOR:23: error: ‘else’ without a previous ‘if’

Yes, there may be obvious problems so please no hate messages!

The setup function doesn't take parameters. You're not supposed to call it, you're supposed to define it.

``````void setup(int x, int y); //make joystick arcade style controller
``````

So, how do you think i should go about doing that? should i put int x and int y with the rest? and void setup used to be void arcade

nickdacreeper:
So, how do you think i should go about doing that? should i put int x and int y with the rest? and void setup used to be void arcade

I can’t follow what you want it to do. But i’m pretty sure that if you want to control some motors with a joystick, you’re going to need some code somewhere to read the joystick.

There has never been a void arcade() function in the Arduino bare bones sketch. I don’t know what you are talking about there.

Maybe you should back burner this project and work through some of the examples until you can see how a basic sketch is put together. Hacking your way through and trying to invent your own syntax is just going to lead to frustration.