problem with dc motor control using xbee and pot

I’m trying to drive a dc motor and servo using 2 arduino unos (one with a osepp motor shield) and 2 xbees controlled with a pot for each respectively. I’ve managed to get the servo working but the dc motor wont work.

here is the sender code

#include <AFMotor.h>
#include <SoftwareSerial.h>
#include <VirtualWire.h>
#include <VirtualWire_Config.h>
#include <Wire.h>
#include <ServoTimer2.h>
#include <EasyTransfer.h>
EasyTransfer ET;

int potpin1 = 0;
int potpin2 = 1;

struct SEND_DATA_STRUCTURE{
  int servo1val;
  int motor1val;
  };

SEND_DATA_STRUCTURE txdata;

void setup(){

  Serial.begin(9600);
  
  ET.begin(details(txdata), &Serial);
  pinMode(potpin1, INPUT);
  pinMode(potpin2, INPUT);
 
}

void loop(){
  
  
  txdata.servo1val = analogRead(potpin1);
  txdata.motor1val = analogRead(potpin2);
 


  txdata.servo1val = map(txdata.servo1val, 0, 1023, 750 , 2250 );    
  
  txdata.motor1val = map(txdata.motor1val, 0, 1023, 0, 255);

  


  Serial.print("txdata.servo1val =");
  Serial.print(txdata.servo1val);
  Serial.print("     ");
  Serial.print("txdata.motor1val =");
  Serial.print(txdata.motor1val);
  
  Serial.println();

 
 
  ET.sendData();
  

}

and the receiver:

#include <AFMotor.h>
#include <Wire.h>
#include <VirtualWire.h>
#include <VirtualWire_Config.h>
#include <ServoTimer2.h>
#include <SoftwareSerial.h>
#include <EasyTransfer.h>
EasyTransfer ET;


AF_DCMotor motor(2);
ServoTimer2 myservo1;



struct RECEIVE_DATA_STRUCTURE{
  int servo1val;
  int motor1val;

};

RECEIVE_DATA_STRUCTURE txdata;

void setup(){

  Serial.begin(9600);

 
  ET.begin(details(txdata), &Serial);
  myservo1.attach(10);

}

void loop(){

   
  if(ET.receiveData()){

  
    myservo1.write(txdata.servo1val);
    motor.setSpeed(txdata.motor1val);
    
    Serial.print("txdata.servo1val =");
    Serial.print(txdata.servo1val);
    Serial.print("     ");
    Serial.print("txdata.motor1val =");
    Serial.print(txdata.motor1val);
  
  Serial.println();
    
  }
}

using this code the servo works fine and the data for both the servo and dc motor is sent, received and can be read in the serial monitor of the receiver uno but is not outputted to the motor. Also, no matter which terminals I send the power to, the voltage across them goes to zero while the other 3 stay at 0.5v

Post a schematic of the wiring connections for the dc motor driver.
FYI,
THIS,

 int potpin1 = 0;
int potpin2 = 1;

means digital pins 0 (Rx ) and 1 (Tx) , NOT A0 and A1.
The pins you defined are NOT analog inputs , they are digital.
analog inputs pins start with an "A", as in A0, A1.
You should know this before you even start writing programs for motor driver.

the DC motor is attached through the motor shield and im using the adafruit motor shield library AFMotor. ive attached the schematic for the shield and changed the potpins to A0 and A1. Still nothing.

I need to know if the motor shield works fine by itself without using serial commands.
Wire it up and drive it without using the serial port
Let me know if it works

okay so everything works fine now. im not entirely sure what the problem was.

Heres the sender code

#include <AFMotor.h>
#include <SoftwareSerial.h>
#include <VirtualWire.h>
#include <VirtualWire_Config.h>
#include <Wire.h>
#include <ServoTimer2.h>
#include <EasyTransfer.h>
EasyTransfer ET;

int potpin1 = 0;
int potpin2 = 1;

struct SEND_DATA_STRUCTURE{
  int servo1val;
  int motor1val;
  };

SEND_DATA_STRUCTURE txdata;

void setup(){

  Serial.begin(9600);
  
  ET.begin(details(txdata), &Serial);
  pinMode(potpin1, INPUT);
  pinMode(potpin2, INPUT);
 
}

void loop(){
  
  
  txdata.servo1val = analogRead(potpin1);
  txdata.motor1val = analogRead(potpin2);
 


  txdata.servo1val = map(txdata.servo1val, 0, 1023, 750 , 2250 );    
  
  txdata.motor1val = map(txdata.motor1val, 0, 1023, 0, 255);

  


  Serial.print("txdata.servo1val =");
  Serial.print(txdata.servo1val);
  Serial.print("     ");
  Serial.print("txdata.motor1val =");
  Serial.print(txdata.motor1val);
  
  Serial.println();

 
 
  ET.sendData();
  

}

and the reciever

#include <AFMotor.h>
#include <Wire.h>
#include <VirtualWire.h>
#include <VirtualWire_Config.h>
#include <ServoTimer2.h>
#include <SoftwareSerial.h>
#include <EasyTransfer.h>

EasyTransfer ET;
AF_DCMotor motor(3);
ServoTimer2 myservo1;
//ServoTimer2 myservo2;


struct RECEIVE_DATA_STRUCTURE{
  int servo1val;
  int motor1val;
};

RECEIVE_DATA_STRUCTURE txdata;

void setup(){
  //Serial.begin(115200);
  Serial.begin(9600);
 
  ET.begin(details(txdata), &Serial);
  myservo1.attach(10);
  motor.run(BACKWARD);

  //myservo2.attach(9);
}

void loop(){
  if(ET.receiveData()){


 
    motor.setSpeed(txdata.motor1val); 
    myservo1.write(txdata.servo1val);
    //motor.run(FORWARD);
    //motor.setSpeed(txdata.motor1val);
    //myservo2.write(txdata.servo2val);
      Serial.print("txdata.servo1val =");
  Serial.print(txdata.servo1val);
  Serial.print("     ");
  Serial.print("txdata.motor1val =");
  Serial.print(txdata.motor1val);
  
  Serial.println();
    
  }
}

thanks for the tip on the analog pins, any tips on cleaning up my code? Also i want to add a button to the sender arduino to change the motor.run(BACKWARD) to motor.run(FORWARD).

Also guessed i changed it back from A0 and A1 to 0 and 1. it still works though so idk what happened lol.