Go Down

Topic: XBee Shield V2.0 Setup Question (Read 1 time) previous topic - next topic

TechMatt

Hey guys!  I apologize if this is an extremely simple question and I am just being an idiot, but I am extremely new to Arduino and need some help here.  I have two Arduino Unos paired with a XBee Shield V2.0 and an XBee S2 (One designated for transmitting and the other for receiving).  I have everything hooked up properly (at least I believe so) but I am unsure if the device is actually transmitting.  Here is the exact code that I put into the device.

Code: [Select]
void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.print('H');
  delay(1000);
  Serial.print('L');
  delay(1000);
}


Also, I have the basic Physical Pixel Communication example set up on the other

Code: [Select]
const int ledPin = 13; // the pin that the LED is attached to
int incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
    }
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);
    }
  }
}


By using the Serial Monitor, I can tell that it is outputting an alternating H or L ever second, but I do not believe if its actually transmitting or not.  My main question is on how to set up the jumpers on the actual board itself to transmit the data over the Serial output.  Here is a picture of the board for clarification with the jumpers visible on the top right area.



Every guide/site that I have been on says something different, so I'm just asking for clarification on how to set up the jumpers on the shield for both the transmitting and receiving modules.  Also, I have not actually programmed the XBee (I was told that it does not need programming for one-to-another communication) so is that a requirement as well?

Thanks for the help guys!

tawandapro

#1
Dec 27, 2014, 12:18 pm Last Edit: Dec 27, 2014, 12:21 pm by tawandapro
Hie there im on the same boat as you at the moment. With the Xbees you must program them with either X-ctu, Putty or Cool Term. I suggest watching Jeremy Blum's Tutorial on wireless control with arduino. As for the sensor shield i am about to buy it but looking for alternatives aswell. but with the jumpers you select which pins you want to use as  TX and RX by the look of it. I'd just leave it at the default TX, RX pins 1,2. Have you tried using the software serial library?  let me know how you go!

tawandapro

I finally got mine working! Because of lack of demo code, i bypassed the rails by removing the jumper caps and connecting jumper leads from any of the TX and RX pins from the shields to the arduino's Rx, and the shields rx to arduino's tx.
I then used this test code to make sure it worked (turns on an led when you push a switch)

here is the tutorial:
http://www.instructables.com/id/Arduino-Wireless-SD-Shield-Tutorial/?ALLSTEPS.
To configure your Xbees properly have a look at this tutorial. one important thing to note though:
"   Set the destination address high of COORDINATOR to serial number high of ROUTER.
    Set the destination address low of COORDINATOR to serial number low of ROUTER.
    Set the destination address high of ROUTER to serial number high of COORDINATOR.
    Set the destination address low of ROUTER to serial number low of COORDINATOR.
    Write these parameters to the modules. " -otherwise they won't communicate.

I did this and my xbees are communicating. The red light should come on when its receiving data. Good luck!

TechMatt

It's working like a charm now! Thanks for all of your help!!

Go Up