More Servo/ xBee questions

Going gently nuts here, this seems like it should be simple. Using a pot to control a servo wirelessly with xBee.

Set the xBee xmtr like so:
my 5678
dl 1234
atdo 2 (adc)
samples before send - 2
sample rate 200 ms

RCVR
my 1234
dl 5678
P0-PWM0 - PWM
IA/IO FFFF

I looked at the data stream with Terminal and it wasn’t jumpy and followed the pot

Then I connected the PWM out to both an LED with a 220 ohm resistor to ground and to pin A0 of an arduino Uno

used this code copied from Mr. Zoomkat with some tweaks:

//zoomkat dual pot/servo test 12-29-12

#include <Servo.h>
Servo myservo1;

int potpin1 = 0; //my pot pin
int newval1, oldval1;

void setup()
{
Serial.begin(9600);
myservo1.attach(9);
Serial.println(“testing xBee Servo”);
}

void loop()
{
newval1 = analogRead(potpin1);
newval1 = map(newval1, 0, 1023, 0, 179);
if (newval1 < (oldval1-2) || newval1 > (oldval1+2)){
myservo1.write(newval1);
Serial.print("Oldval: “);
Serial.print (oldval1);
Serial.print (”\t NewVal1: ");
Serial.println(newval1);
oldval1=newval1;
}

delay(20);
}

The LED follows the pot nicely, but the servo jumps all over the place. Turning the pot moves the servo properly but the jumpiness remains. I thought A0 might not like PWM so I made a filter to convert it to a straight analog voltage (two electrolytics with 1K resistors between them and to the output) but it didn’t change anything. I know I must be doing something fundamentally dumb, but I’m scratching my head .

Oh, here’s what the terminal looks like with no pot change:

Oldval: 41 NewVal1: 38
Oldval: 38 NewVal1: 31
Oldval: 31 NewVal1: 17
Oldval: 17 NewVal1: 13
Oldval: 13 NewVal1: 10
Oldval: 10 NewVal1: 7
Oldval: 7 NewVal1: 10
Oldval: 10 NewVal1: 6
Oldval: 6 NewVal1: 9
Oldval: 9 NewVal1: 6
Oldval: 6 NewVal1: 9
Oldval: 9 NewVal1: 5
Oldval: 5 NewVal1: 8
Oldval: 8 NewVal1: 11
Oldval: 11 NewVal1: 8
Oldval: 8 NewVal1: 11
Oldval: 11 NewVal1: 8
Oldval: 8 NewVal1: 11
Oldval: 11 NewVal1: 3
Oldval: 3 NewVal1: 6

Did you first test the servo setup with the servo connected to to the arduino? Are you using an external power supply with the servo power supply ground and the arduino grounds connected? Where does the exbee fit in the setup?

Okay, figured it out, and learned to use my new dinky little DSO Nano scope at the same time. A0 does NOT like PWM, and I was off by one hole on my breadboard so my filter wasn't doing anything. Works now, though the servo movement is a little jerky, but it's stable.

Learning something new every day, though with my crappy geezer memory it's pretty FIFO