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
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…
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.
I configured the Xbee’s one as a coordinator and other as a router.
I checked the configuration manually by entering into the command mode.
I attached one Xbee on the “arduino/Xbee shield” and the other Xbee to the “Xbee USB explorer” board.
The arduino/Xbee Shield setup is connected to my Mac book and the Xbee USB explorer to my XP comp.
Using the the X-CTU on my windows XP comp, I entered into the command mode and sent D from Terminal window.
Ideally I should receive something on my arduino. I am unable to receive anything over my arduino.
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);
}
}
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.
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