wireless control of dc motor with potentiometer

Hello all,

I would like to wirelessly control a DC motor by rotating a potentiometer. I have the potentiometer hooked up to an arduino uno with a SparkFun xbee shield and a series 1 xbee. I want to attach the dc motor to an ardumoto shield from SparkFun (https://www.sparkfun.com/products/9815) which will be attached to an arduino uno and another SparkFun xbee shield with another series 1 xbee. The two xbees are configured and below is a sample code I used to communicate between the xbees. (the second xbee was simple plugged into the usb and i read the seral values from the potentiometer). I would like to use the same transmitter code to control the DC motor but I don’t know how to write the code for the receiver arduino.

thanks a lot,

transmitter code:

int potPin = 0;

void setup()

void loop()
int val = map(analogRead(potPin), 0, 1023, 0, 255);