XbeeShield/Arduino and LDR

I have 2 x Arduinos, 2 Xbee S2 and 2 Xbee shields…I was able to get them communicating and to turn a LED on and off by transmitting ‘1’ and ‘0’ but now Im trying to using a LDR to measure the light using 1 xbee/shield/arduino as a sensor and transmitter and other xbee as a receiver connected to my lap top throught serial port…

I have this code written to that mesaures the light using the LDR but when i try and send it using XbeeShield, doesnt work and get the constant reading(28263)…

I am looking for a bit of help/direction in order to send the sensorReading so that the results can be viewed on the serial monitor using other arduino etc… connected to PC

CODE

int analogPin = 0;

int sensorReading;

void setup()

{

Serial.begin(9600);

}

void loop()

{

sensorReading = analogRead(analogPin);

Serial.println(‘sensorReading’, DEC); ///problem here somewhere

delay(1000);

}

I think the line of code should be like this:

Serial.println(sensorReading, DEC); // no paranthesis

Hi,

How did you make the xbee shield work with the arduino board?

I am having problem connecting to it.

I got two xbee shields from sparkfun http://www.sparkfun.com/products/9976 and the series 1 xbee chip antennas.

I am trying to make two xbees talk to each other. So I used two arduino uno boards, two xbee antennas and two xbee shields.

While I’m trying to upload code to the arduino boards, it always fails with these errors:

avrdude: stk500_getsync(): not in sync: resp=0x86

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

But if I take the xbee shield and xbee off of the arduino board, I can upload the code to the arduino board without any problem.

Does anyone know what might be causing the problem? I tried disconnect the board and then connect it again, I also tried pressing the reset button. Neither worked…

Hi Guys,

My project is to control a servo motor remotely. For this project I have purchased 1 arduino uno, 2 Xbee series 2 RPSMA, 2 Xbee shields and a Xbee USB explorer.

I am stuck at a certain point. I would be very thankful to you people if you could help me on this project. I have done the following steps to get it work.

  1. I have connected the Xbee shield http://www.sparkfun.com/products/9976 with the arduino board

  2. I configured the Xbee’s one as a coordinator and other as a router.

  3. I checked the configuration manually by entering into the command mode.

  4. I attached one Xbee on the “arduino/Xbee shield” and the other Xbee to the “Xbee USB explorer” board.

  5. The arduino/Xbee Shield setup is connected to my Mac book and the Xbee USB explorer to my XP comp.

  6. Using the the X-CTU on my windows XP comp, I entered into the command mode and sent D from Terminal window.

  7. Ideally I should receive something on my arduino. I am unable to receive anything over my arduino.

  8. Later I figured out that may be I should write a program and upload it to read the data. So I wrote this

void setup()

{

Serial.begin(9600);

}

void loop()

{

void loop()

{

// look for a capital D over the serial port

if (Serial.available() > 0)

{

if (Serial.read() == ‘D’){

Serial.print(‘H’);

delay(1000);

Serial.print(‘L’);

delay(1000);

}

}

  1. I uploaded the sketch, checked the serial monitor when I am transmitting from X-CTU. I dont receive anything. Also when I connect my shield i have “power and DI05” LED On always on the Xbee Shield. Also I am not sure whether it should be in UART mode or Dline while receiving. I would thankful to you guys if u could help me on this.

  2. My Xbee configurations details is below

For Coordinator:

+++OK

ATID 2001

OK

ATDH 0013A200

OK

ATDL 406F197D

OK

ATWR

For Router :

+++OK

ATID 2001

OK

ATDH 0013A200

OK

ATDL 406F1B29

OK

ATWR

Awaiting your kind reply.

littlehead:
Hi,

How did you make the xbee shield work with the arduino board?

I am having problem connecting to it.

I got two xbee shields from sparkfun http://www.sparkfun.com/products/9976 and the series 1 xbee chip antennas.

I am trying to make two xbees talk to each other. So I used two arduino uno boards, two xbee antennas and two xbee shields.

While I’m trying to upload code to the arduino boards, it always fails with these errors:

avrdude: stk500_getsync(): not in sync: resp=0x86

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

But if I take the xbee shield and xbee off of the arduino board, I can upload the code to the arduino board without any problem.

Does anyone know what might be causing the problem? I tried disconnect the board and then connect it again, I also tried pressing the reset button. Neither worked…

have you trying changing the position on the switch on the xbee shields? if the switch is in the DLINE position the usb port isnt connected to the arduino and it wont be able to be programmed