Pages: [1]   Go Down
Author Topic: separate Arduino with zigbee s2  (Read 383 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


hello

I have a problem to prepare a simple connection between:

1. arduino with chip atmega (only power supply) + zigbee s2 coordinator
2. arduino with chip atmega (only power supply) + zigbee s2 router/end device

the transmision have to be in two way, it's mean, Coordinator send message to router "blink the dode and give me your temperature", router blinked and send to the coordinator data with actualy temperature.

And the problem is, coordinator send this message, router blinked but dont send data about temperature ;/

so i prepare the simple program with only blinking - coordinator send to router blink the diode and the router send to coordinator blink the diode and in this configuration only router blinking (jumper on xbee/usb shield is on xbee)
http://www.cooking-hacks.com/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/a/r/ardxbee2_1.jpg



coordinator
Code:
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:
 
  Serial.print("H");
  delay(500);
  Serial.print("L");
  delay(500);
 
  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 == 'A') {
      digitalWrite(ledPin, HIGH);
    }
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'B') {
      digitalWrite(ledPin, LOW);
    }
  }
}


router
Code:
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:
 
  Serial.print("A");
  delay(500);
  Serial.print("B");
  delay(500);
 
  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);
    }
  }
}


Of course the transmission in two way working if i connect zigbee via usb without chip atmel and when I use terminal
Logged

Pages: [1]   Go Up
Jump to: