need help in my programe .

hello guys , i'm making robot ( line car + arm hold and up and down and drop item ) and it's almost done .

i need change controlling in my car and arm to joystick including 2 pots and 4 push button my car have 4 motors and my arm have two motors , one for up and down and one for hold and drop . i need use the 2pots to control the 4 motors which make my car in all direction and the 4 push button to control the arm motors . the push buttons is done coding but the 2 pots i can't and i searched in all codes in the site and others . but i failed to code it .

my auto pilot code was :

int m1_f=2; int m1_b=3; int m2_f=4; int m2_b=5; int m3_f=6; int m3_b=7; int m4_f=8; int m4_b=9; int m5_up=22; int m5_down=23; int m6_hold=24; int m6_drop=25;

int sen1=10; int sen2=11; int sen3=12; int sen4=13;

int sen1_val; int sen2_val; int sen3_val; int sen4_val;

void setup() { // put your setup code here, to run once: pinMode(m1_f,OUTPUT); pinMode(m1_b,OUTPUT); pinMode(m2_f,OUTPUT); pinMode(m2_b,OUTPUT); pinMode(m3_f,OUTPUT); pinMode(m3_b,OUTPUT); pinMode(m4_f,OUTPUT); pinMode(m4_b,OUTPUT); pinMode(m5_up,OUTPUT); pinMode(m5_down,OUTPUT); pinMode(m6_hold,OUTPUT); pinMode(m6_drop,OUTPUT);

pinMode(sen1,INPUT); pinMode(sen2,INPUT); pinMode(sen3,INPUT); pinMode(sen4,INPUT); }

void loop() { // put your main code here, to run repeatedly:

}

void robot_fw(){

analogWrite(m1_f , 150); digitalWrite(m1_b , LOW); analogWrite(m2_f , 150); digitalWrite(m2_b , LOW); analogWrite(m3_f , 150); digitalWrite(m3_b , LOW); analogWrite(m4_f , 150); digitalWrite(m4_b , LOW);

}

void robot_bw(){

digitalWrite(m1_f , LOW); analogWrite(m1_b , 150); digitalWrite(m2_f , LOW); analogWrite(m2_b , 150); digitalWrite(m3_f , LOW); analogWrite(m3_b , 150); digitalWrite(m4_f , LOW); analogWrite(m4_b , 150);

}

void robot_left(){

digitalWrite(m1_f , LOW); analogWrite(m1_b , 150); analogWrite(m2_f , 150); digitalWrite(m2_b , LOW); digitalWrite(m3_f , LOW); analogWrite(m3_b , 150); analogWrite(m4_f , 150); digitalWrite(m4_b , LOW);

}

void robot_right(){

analogWrite(m1_f , 150); digitalWrite(m1_b , LOW); digitalWrite(m2_f , LOW); analogWrite(m2_b , 150); analogWrite(m3_f , 150); digitalWrite(m3_b , LOW); digitalWrite(m4_f , LOW); analogWrite(m4_b , 150);

}

void robot_stop(){

digitalWrite(m1_f , LOW); digitalWrite(m1_b , LOW); digitalWrite(m2_f , LOW); digitalWrite(m2_b , LOW); digitalWrite(m3_f , LOW); digitalWrite(m3_b , LOW); digitalWrite(m4_f , LOW); digitalWrite(m4_b , LOW);

}

void robot_arm_hold(){

analogWrite(m6_hold , 150); digitalWrite(m6_drop , LOW);

}

void robot_arm_drop(){

digitalWrite(m6_hold , LOW); analogWrite(m6_drop , 150);

}

void robot_arm_stop(){

digitalWrite(m6_hold , LOW); digitalWrite(m6_drop , LOW);

}

void robot_up(){

digitalWrite(m5_up , HIGH); digitalWrite(m5_down , LOW); }

void robot_down(){

digitalWrite(m5_up , LOW); digitalWrite(m5_down , HIGH); }

void auto_pilot(){

sen1_val=digitalRead(sen1);

sen2_val=digitalRead(sen2);

sen3_val=digitalRead(sen3);

sen4_val=digitalRead(sen4);

if (sen1_val==HIGH&&sen2_val==HIGH&&sen3_val==LOW){robot_fw();}

if (sen1_val==HIGH&&sen2_val==LOW&&sen3_val==LOW){robot_left();}

if (sen1_val==LOW&&sen2_val==LOW&&sen3_val==HIGH){robot_right();}

if (sen1_val==LOW&&sen2_val==LOW&&sen3_val==LOW){robot_stop(); delay(4000); robot_left(); if (sen4_val==HIGH){robot_stop(); delay(1000); robot_down(); delay(8000); robot_arm_hold(); delay(3000); robot_arm_stop(); delay(1000); robot_up(); delay(3000); } robot_left(); }

}

and this code which i thought in :

int m1_f=2; int m1_b=3; int m2_f=4; int m2_b=5; int m3_f=6; int m3_b=7; int m4_f=8; int m4_b=9;

const int analoginpin1 = A2; const int analoginpin2 = A3;

int joy_value1 = 0; int joy_value2 = 0;

int motors_value1 = 0; int motors_value2 = 0;

void setup() { Serial.begin(9600);

pinMode(m1_f,OUTPUT); pinMode(m1_b,OUTPUT); pinMode(m2_f,OUTPUT); pinMode(m2_b,OUTPUT); pinMode(m3_f,OUTPUT); pinMode(m3_b,OUTPUT); pinMode(m4_f,OUTPUT); pinMode(m4_b,OUTPUT);

}

void loop() {

joy_value1 = analogRead(analoginpin1); joy_value2 = analogRead(analoginpin2);

motors_value1 = map(joy_value1, 0, 1023, 0, 255); motors_value2 = map(joy_value2, 0, 1023, 0, 255);

analogWrite(here i want to put more than one pin(m1_f + m2_f) , motors_value1); analogWrite(m1_b , motors_value2);

delay(2); }

void robot_fw(){ analogWrite(m1_f,HIGH); digitalWrite(m1_b,LOW); analogWrite(m2_f,HIGH);; digitalWrite(m2_b,LOW); analogWrite(m3_f,HIGH); digitalWrite(m3_b,LOW); analogWrite(m4_f,HIGH); digitalWrite(m4_b,LOW);

}

void robot_bw(){ digitalWrite(m1_f,LOW); analogWrite(m1_b,HIGH); digitalWrite(m2_f,LOW); analogWrite(m2_b,HIGH); digitalWrite(m3_f,LOW); analogWrite(m3_b,HIGH); digitalWrite(m4_f,LOW); analogWrite(m4_b,HIGH);

}

void robot_stop(){

digitalWrite(m1_f,LOW); digitalWrite(m1_b,LOW); digitalWrite(m2_f,LOW); digitalWrite(m2_b,LOW); digitalWrite(m3_f,LOW); digitalWrite(m3_b,LOW); digitalWrite(m4_f,LOW); digitalWrite(m4_b,LOW);

}

void robot_left(){

analogWrite(m1_f,HIGH); digitalWrite(m1_b,LOW); digitalWrite(m2_f,LOW); analogWrite(m2_b,HIGH); analogWrite(m3_f,HIGH); digitalWrite(m3_b,LOW); digitalWrite(m4_f,LOW); analogWrite(m4_b,HIGH);

}

// ???? ????? ??????? ??? ?????? void robot_right(){

digitalWrite(m1_f,LOW); analogWrite(m1_b,HIGH); analogWrite(m2_f,HIGH); digitalWrite(m2_b,LOW); digitalWrite(m3_f,LOW); analogWrite(m3_b,HIGH); analogWrite(m4_f,HIGH); digitalWrite(m4_b,LOW);

}

pls i need help fast fast as anyone can ...

analogWrite(here i want to put more than one pin(m1_f + m2_f) , motors_value1); analogWrite(m1_b , motors_value2);

You can't use more than one pin like that, you need to split them up.

delay(4000); robot_left(); if (sen4_val==HIGH){robot_stop(); delay(1000); robot_down(); delay(8000); robot_arm_hold(); delay(3000); robot_arm_stop(); delay(1000); robot_up(); delay(3000);

These delays are going to be an issue, because they won't let you do anything else until they are done. So if that IF statement condition is true, then you will need to wait until it is false to do anything afterward. But if your willing to wait, then you can use it, but I highly recommend you look into the Blink Without Delay example for a better "delay" solution.

One more thing, when does auto_pilot() ever get called?

if i can't user more than one pin , and i can't call function like [ auto_pikot()] .. what can i do if i need the 4 motors turn on in the same time in this line : analogWrite(m1_b , motors_value2);


the code i wrote i finished it , i but it just to understand for whom reading my topic ...

if i can’t user more than one pin , and i can’t call function like [ auto_pikot()] …

I asked when does the function ever get called?

the code i wrote i finished it , i but it just to understand for whom reading my topic …

??? Can you post your finished code.

you can't understand me ,, sry for this . this is the code which i want to complete , which i can't complete it . in this code i need control 4 motor (car motor) using 2 pots , can i and if i can , how ?

int m1_f=2; int m1_b=3; int m2_f=4; int m2_b=5; int m3_f=6; int m3_b=7; int m4_f=8; int m4_b=9;

const int analoginpin1 = A2; const int analoginpin2 = A3;

int joy_value1 = 0; int joy_value2 = 0;

int motors_value1 = 0; int motors_value2 = 0;

void setup() { Serial.begin(9600);

pinMode(m1_f,OUTPUT); pinMode(m1_b,OUTPUT); pinMode(m2_f,OUTPUT); pinMode(m2_b,OUTPUT); pinMode(m3_f,OUTPUT); pinMode(m3_b,OUTPUT); pinMode(m4_f,OUTPUT); pinMode(m4_b,OUTPUT);

}

void loop() {

joy_value1 = analogRead(analoginpin1); joy_value2 = analogRead(analoginpin2);

motors_value1 = map(joy_value1, 0, 1023, 0, 255); motors_value2 = map(joy_value2, 0, 1023, 0, 255);

analogWrite(here i want to put more than one pin(m1_f + m2_f) , motors_value1); analogWrite(m1_b , motors_value2);

delay(2); }

void robot_fw(){ analogWrite(m1_f,HIGH); digitalWrite(m1_b,LOW); analogWrite(m2_f,HIGH);; digitalWrite(m2_b,LOW); analogWrite(m3_f,HIGH); digitalWrite(m3_b,LOW); analogWrite(m4_f,HIGH); digitalWrite(m4_b,LOW);

}

void robot_bw(){ digitalWrite(m1_f,LOW); analogWrite(m1_b,HIGH); digitalWrite(m2_f,LOW); analogWrite(m2_b,HIGH); digitalWrite(m3_f,LOW); analogWrite(m3_b,HIGH); digitalWrite(m4_f,LOW); analogWrite(m4_b,HIGH);

}

void robot_stop(){

digitalWrite(m1_f,LOW); digitalWrite(m1_b,LOW); digitalWrite(m2_f,LOW); digitalWrite(m2_b,LOW); digitalWrite(m3_f,LOW); digitalWrite(m3_b,LOW); digitalWrite(m4_f,LOW); digitalWrite(m4_b,LOW);

}

void robot_left(){

analogWrite(m1_f,HIGH); digitalWrite(m1_b,LOW); digitalWrite(m2_f,LOW); analogWrite(m2_b,HIGH); analogWrite(m3_f,HIGH); digitalWrite(m3_b,LOW); digitalWrite(m4_f,LOW); analogWrite(m4_b,HIGH);

}

// ???? ????? ??????? ??? ?????? void robot_right(){

digitalWrite(m1_f,LOW); analogWrite(m1_b,HIGH); analogWrite(m2_f,HIGH); digitalWrite(m2_b,LOW); digitalWrite(m3_f,LOW); analogWrite(m3_b,HIGH); analogWrite(m4_f,HIGH); digitalWrite(m4_b,LOW);

}

here i want to put more than one pin(

You can't.

Use two analogWrites.

Please also use CODE TAGS.

Here is an example function:

byte LMF = 3;// PWM Left motor forward pin
byte LMR = 5;// PWM Left motor Reverse pin
byte RMF = 11;// PWM Right motor forward pin
byte RMR = 6;// PWM Right motor reverse pin

/*Rest of code here*/

void move(int z, int y, int DZ)// z = analog_1, y = analog_2, DZ = dead/neutral zone factor.
{  
  //Movement varibles
  int DRV2 = map(z, 0, 512 - DZ, 255, 0);
  int DRV1 = map(z, 512 + DZ, 1023, 0, 255);
  int STRL = map(y, 0, 512 - DZ, 255, 0);
  int STRR = map(y, 512+ DZ, 1023, 0, 255);

  if(z > 512)//forwards               
  {
    //Serial.println("Forward with turning"); 
    analogWrite(LMF, constrain(abs(DRV1 - STRL),0,255)); 
    analogWrite(RMF, constrain(abs(DRV1 - STRR),0,255));   
    digitalWrite(LMR, LOW); 
    digitalWrite(RMR, LOW);   
  }
  else if(z < 512)//backwards               
  {
    //Serial.println("Reverse with turning"); 
    digitalWrite(LMF, LOW); 
    digitalWrite(RMF, LOW);   
    analogWrite(LMR, constrain(abs(DRV2 - STRL),0,255)); 
    analogWrite(RMR, constrain(abs(DRV2 - STRR),0,255));   
  }
  else if(z == 512 && y > 512)//Right               
  {
    //Serial.println("360 left"); 
    digitalWrite(LMR, LOW); 
    analogWrite(RMR, STRR);   
    analogWrite(LMF, STRR); 
    digitalWrite(RMF, LOW);
  }
  else if(z == 512 && y < 512)//Left              
  {
    //Serial.println("360 right"); 
    analogWrite(LMR, STRL); 
    digitalWrite(RMR, LOW);   
    digitalWrite(LMF, LOW); 
    analogWrite(RMF, STRL);   
  }

  else //full stop
  { 
    digitalWrite(LMF, LOW); 
    digitalWrite(RMF, LOW);        
    digitalWrite(LMR, LOW); 
    digitalWrite(RMR, LOW);    
  }
}

i can't understand ur code , and i can't understand Axis joystick how it program =(

can you write code for me . code for 4 motors using two pots . i will fail the exam tomorow i have to finish my robot today =( =(

okey karam .. i found that there is no setup or loop function in ur code .

It was an example [u]function[/u], not full code.

To use the function, it should be like this.

void setup()
{
  /* pinModes */
}

void loop()
{
  move(analogRead(analoginpin1), analogRead(analoginpin2), 6); // 6 is the deadzone, so you can have some slack when your joystick returns to center.
}

/* You can fill in the rest */

You should also not be driving the motors directly from the arduino, you can burn it out like that, instead you should be using a motor driver, if you're not already.

look this is my car , and i’m using drivers . and every thing i right but i need acode .


https://www.mediafire.com/?26lbicuduob1130

can you explain to me your code :
int DRV2 = map(z, 0, 512 - DZ, 255, 0);
int DRV1 = map(z, 512 + DZ, 1023, 0, 255);

i’m trying to write code like your one but for 4 motors . so can i post it when i finish to tell me what’s wrong with it …

The analogRead returns a value between 0 and 1023 when reading the pot. When your joystick is centered, the value is usually 512, however this in never always true, sometimes it is above 512 or below, so DZ helps o give you more slack.

You want the motors to go forward and reverse, and what I have done is split the joystick value into two variables, DRV1 and DRV2. DRV1 handles forward movement, and DRV2 is reverse. There are also IF statements that monitor the variable z to see whether the car should be going forward or reverse based on the value. This function also handles skid steering, (constrain(abs(DRV1 - STRL),0,255) ) so Forward and Left gets calculated and the car moves forward and to the left. Same for reverse.

Why use 2 motor drivers if one should be enough, just wire both motors (on the same side) to the same pins. Also I didn’t see an external battery in the picture, so are you powering the motor drivers from the Arduino directly or from a battery pack?

can you see my code and tell me if it right ?

byte LMF = 3;// PWM Left motor forward pin
byte LMR = 5;// PWM Left motor Reverse pin
byte RMF = 11;// PWM Right motor forward pin
byte RMR = 6;// PWM Right motor reverse pin
byte LMF2 = 2; 
byte LMR2 = 4;
byte RMF2 = 7;
byte RMR2 = 8;
/*Rest of code here*/


void move(int z, int y, int DZ)// z = analog_1, y = analog_2, DZ = dead/neutral zone factor.




{  
  //Movement varibles
  int DRV2 = map(z, 0, 512 - DZ, 255, 0);
  int DRV1 = map(z, 512 + DZ, 1023, 0, 255);
  int STRL = map(y, 0, 512 - DZ, 255, 0);
  int STRR = map(y, 512+ DZ, 1023, 0, 255);

  if(z > 512)//forwards               
  {
    //Serial.println("Forward with turning"); 
    analogWrite(LMF, constrain(abs(DRV1 - STRL),0,255)); 
    analogWrite(RMF, constrain(abs(DRV1 - STRR),0,255));
    analogWrite(LMF2, constrain(abs(DRV1 - STRR),0,255)); 
    analogWrite(RMF2, constrain(abs(DRV1 - STRR),0,255));  
    digitalWrite(LMR, LOW); 
    digitalWrite(RMR, LOW);
    digitalWrite(LMF2, LOW);
    digitalWrite(RMR2, LOW); 
  }
  else if(z < 512)//backwards               
  {
    //Serial.println("Reverse with turning"); 
    digitalWrite(LMF2, LOW); 
    digitalWrite(RMF2, LOW); 
    digitalWrite(LMF, LOW); 
    digitalWrite(RMF, LOW);   
    analogWrite(LMR, constrain(abs(DRV2 - STRL),0,255)); 
    analogWrite(RMR, constrain(abs(DRV2 - STRR),0,255));
    analogWrite(LMF2, constrain(abs(DRV2 - STRR),0,255));
    analogWrite(RMR2, constrain(abs(DRV2 - STRR),0,255)); 
  }
  else if(z == 512 && y > 512)//Right               
  {
    //Serial.println("360 left"); 
    digitalWrite(LMR, STRR); 
    analogWrite(RMR, LOW);   
    analogWrite(LMF, LOW); 
    digitalWrite(RMF, STRR);
    
    digitalWrite(LMR2, STRR); 
    analogWrite(RMR2, LOW);
    digitalWrite(LMF2, LOW); 
    analogWrite(RMF2, STRR);
  }
  else if(z == 512 && y < 512)//Left              
  {
    //Serial.println("360 right"); 
    analogWrite(LMR, LOW); 
    digitalWrite(RMR, STRL);   
    digitalWrite(LMF, STRL); 
    analogWrite(RMF, LOW); 
  
    analogWrite(LMR2, LOW); 
    digitalWrite(RMR2, STRL);   
    digitalWrite(LMF2, STRL); 
    analogWrite(RMF2, LOW);  
  }

  else //full stop
  { 
    digitalWrite(LMF, LOW); 
    digitalWrite(RMF, LOW);        
    digitalWrite(LMR, LOW); 
    digitalWrite(RMR, LOW);

    digitalWrite(LMF2, LOW); 
    digitalWrite(RMF2, LOW);        
    digitalWrite(LMR2, LOW); 
    digitalWrite(RMR2, LOW);      
  }
}

this pic is half of the car , yes i use battery , i have every thing right , all i need is program to control it …

i’m very pleased for your help ,

i used two drivers to save them from burning

Im not writing the code for you, YOU can do that. In fact you need to understand your own mistakes in order to correct and pass that exam. If this is giving you a hard time then, you need to do some serious studying.

Check your pins again, and make sure everything is in the correct spot. My wiring is different from yours, so just double check. Have you tested the code on the robot?

Also

digitalWrite(LMR, LOW); digitalWrite(RMR, LOW); digitalWrite(LMF2, LOW); // Things like this will cause the code to fail. digitalWrite(RMR2, LOW);

You are also missing your setup() function and loop(). If you can't figure out how to solve your own code and also have an exam tomorrow, you're going to fail. You need to comprehend how the arduino works and how to write/structure the code. Also testing is always a good way to see if the code works or not.

i'm doing my best and i'm doing too many researching on the internet . but it's hard with me to understand thing . i know you become annoying from me , but i ask to understand ...

what this code mean pls .. analogWrite(LMF, constrain(abs(DRV1 - STRL),0,255));

and pls last question can u put void loop and setup in your code and rewrite it again ^_^

http://arduino.cc/en/Reference/Constrain

You already have the loop function, I gave it to you.

void loop() { move(analogRead(analoginpin1), analogRead(analoginpin2), 6); // 6 is the deadzone, so you can have some slack when your joystick returns to center. }

All you need to do now is add the pinModes in the setup() function, like how you have here, just change the variables.

void setup() { Serial.begin(9600);

pinMode(m1_f,OUTPUT); pinMode(m1_b,OUTPUT); pinMode(m2_f,OUTPUT); pinMode(m2_b,OUTPUT); pinMode(m3_f,OUTPUT); pinMode(m3_b,OUTPUT); pinMode(m4_f,OUTPUT); pinMode(m4_b,OUTPUT);

}

As for this, you can probably do without the constrain, and just have ... for each. analogWrite(LMF, abs(DRV1 - STRL) );

This takes the difference from "forward/ reverse" and "left and right" values and allows the robot to drive the way the joystick is moved. forward + left = the robot moves forward and to the left.

see i got error every time that
initializer before ’ void ’
unqualified-id before ‘{’ token

can you have alook …

byte LMF = 3;// PWM Left motor forward pin
byte LMR = 5;// PWM Left motor Reverse pin
byte RMF = 11;// PWM Right motor forward pin
byte RMR = 6;// PWM Right motor reverse pin
byte LMF2 = 2; 
byte LMR2 = 4;
byte RMF2 = 7;
byte RMR2 = 8;
/*Rest of code here*/
int joy1=A0;
int joy2=A1;


void setup(){
  pinMode(LMF,OUTPUT);
  pinMode(LMR,OUTPUT);
  pinMode(RMF,OUTPUT);
  pinMode(RMR,OUTPUT);
  pinMode(LMF2,OUTPUT);
  pinMode(LMR2,OUTPUT);
  pinMode(RMF2,OUTPUT);
  pinMode(RMR2,OUTPUT);
  pinMode(joy1,INPUT);
  pinMode(joy2,INPUT);
}



void move(int z, int y, int DZ)// z = analog_1, y = analog_2, DZ = dead/neutral zone factor.

void loop(){
  move(analogRead(joy1),analogRead(joy2),6);
}


{  
  //Movement varibles
  int DRV2 = map(z, 0, 512 - DZ, 255, 0);
  int DRV1 = map(z, 512 + DZ, 1023, 0, 255);
  int STRL = map(y, 0, 512 - DZ, 255, 0);
  int STRR = map(y, 512+ DZ, 1023, 0, 255);

  if(z > 512)//forwards               
  {
    //Serial.println("Forward with turning"); 
    analogWrite(LMF, constrain(abs(DRV1 - STRL),0,255)); 
    analogWrite(RMF, constrain(abs(DRV1 - STRR),0,255));
    analogWrite(LMF2, constrain(abs(DRV1 - STRL),0,255)); 
    analogWrite(RMF2, constrain(abs(DRV1 - STRR),0,255));  
    digitalWrite(LMR, LOW); 
    digitalWrite(RMR, LOW);
    digitalWrite(LMF2, LOW);
    digitalWrite(RMR2, LOW); 
  }
  else if(z < 512)//backwards               
  {
    //Serial.println("Reverse with turning"); 
    digitalWrite(LMF2, LOW); 
    digitalWrite(RMF2, LOW); 
    digitalWrite(LMF, LOW); 
    digitalWrite(RMF, LOW);   
    analogWrite(LMR, constrain(abs(DRV2 - STRL),0,255)); 
    analogWrite(RMR, constrain(abs(DRV2 - STRR),0,255));
    analogWrite(LMF2, constrain(abs(DRV2 - STRL),0,255));
    analogWrite(RMR2, constrain(abs(DRV2 - STRR),0,255)); 
  }
  else if(z == 512 && y > 512)//Right               
  {
    //Serial.println("360 left"); 
    digitalWrite(LMR, STRR); 
    analogWrite(RMR, LOW);   
    analogWrite(LMF, LOW); 
    digitalWrite(RMF, STRR);
    
    digitalWrite(LMR2, STRR); 
    analogWrite(RMR2, LOW);
    digitalWrite(LMF2, LOW); 
    analogWrite(RMF2, STRR);
  }
  else if(z == 512 && y < 512)//Left              
  {
    //Serial.println("360 right"); 
    analogWrite(LMR, LOW); 
    digitalWrite(RMR, STRL);   
    digitalWrite(LMF, STRL); 
    analogWrite(RMF, LOW); 
  
    analogWrite(LMR2, LOW); 
    digitalWrite(RMR2, STRL);   
    digitalWrite(LMF2, STRL); 
    analogWrite(RMF2, LOW);  
  }

  else //full stop
  { 
    digitalWrite(LMF, LOW); 
    digitalWrite(RMF, LOW);        
    digitalWrite(LMR, LOW); 
    digitalWrite(RMR, LOW);

    digitalWrite(LMF2, LOW); 
    digitalWrite(RMF2, LOW);        
    digitalWrite(LMR2, LOW); 
    digitalWrite(RMR2, LOW);      
  }
}

void move(int z, int y, int DZ)// z = analog_1, y = analog_2, DZ = dead/neutral zone factor.

void loop(){ move(analogRead(joy1),analogRead(joy2),6); }

{ //Movement varibles

Spacing is important, try this.

void loop()
{
  move(analogRead(joy1),analogRead(joy2),6);
}

void move(int z, int y, int DZ)// z = analog_1, y = analog_2, DZ = dead/neutral zone factor.
{  
  //Movement varibles