I made the following changes
In Step 3 Use UART software to Tx-Rx between Arduino UNO and Seeeduino Stalker
Made this configuration
-In Sender I plug a jumper wire between xbee XB_TX (3) and Digital and a jumper wire between xbee XB_RX (2) and Digital
-In Receiver I plug a jumper wire between xbee XB_TX (2) and Digital and a jumper wire between xbee XB_RX (3) and Digital.
I wonted to read Sensor data and send to through XBee.
I have used this code to communicate
Sender Code
[code]#include <Wire.h>
#include <SoftwareSerial.h>
SoftwareSerial xbee1(3, 2);
// ----CONSTANTS (won’t change)
#define SENSOR1 A0
//------- VARIABLES (will change)
int sensorValue;
float outVoltage;
int Level;
void setup() {
Serial.begin(9600);
xbee1.begin( 9600 );
}
void loop() {
sensorValue = analogRead(A0);
outVoltage = sensorValue * (5.0 / 1023.0);
delay (50);
Level = 6*outVoltage;//The level of wind speed is proportional to the output voltage.
int val = map(Level, 0, 30, 0, 30);
Serial.println(val);
delay (500);
xbee1.write(val);
if( Serial.available( ) ) {
/* If data comes in from serial monitor, send it out to XBee */
xbee1.write( Serial.read( ) );
}
if( xbee1.available( ) ) {
/* If data comes in from XBee, send it out to serial monitor */
Serial.write( xbee1.read( ) );
}
}[/code]
Reciever Code
[code]#include <SoftwareSerial.h>
SoftwareSerial xbee1(2, 3);
void setup() {
Serial.begin(9600);
delay( 10 );
xbee1.begin( 9600 );
}
void loop() {
if( Serial.available( ) ) {
/* If data comes in from serial monitor, send it out to XBee */
xbee1.write( Serial.read( ) );
}
if( xbee1.available( ) ) {
/* If data comes in from XBee, send it out to serial monitor */
Serial.write( xbee1.read( ) );
}
}[/code]