Hi.
I want to read the voltage of the transmitting xbee connected to a pot, that is sent to the receiving xbee connected to a logic level converter to the Arduino. I am using two xbee series 1 modules in transparent mode, and one arduino rev 3. A pot is connected to the transmitting xbee. The arduino is connected to the receiving xbee. I have a logic level converter between the arduino and xbee.
Everything works great if I use an LED connected to the receiving xbee instead of the arduino. Wirelessly The LED dims and brightens as expected. I also can measure the voltage with a volt meter and can read 0 to 5 volts on the receiving xbee pwm output. Everything changes when remove the LED connected directly to the receiving xbee, and attach the PWM signal from the receiving xbee to the ardino analog input.
My wild guess is that the arduino analog input is sampling the xbee pwm output, and perhaps the PWM frequencies diferences are causing problems? If so How would I correct this. Ultimately I would like to make use of a motor controller and build my first robot. This is my beginning. I am learning API and xbee, but it seems the transparent mode is simpler.
My code:
float val = 0;
float result = 0;
void setup()
{
pinMode(val,INPUT);
Serial.begin(9600);
}
void loop()
{
result = analogRead(val);
delay(100);
Serial.println(result/4); // gives me 0 to 255 in prep for analog write to a motor controller
delay(500);
}
Thank you so much for your help.
Scott