Home/Support/Support Forum/i am using two XBees and one Arduino and trying to send analog data over XBEE AND DISPALY ON SERIAL MONITOR

i am using two XBees and one Arduino and trying to send analog data over XBEE AND DISPALY ON SERIAL MONITOR

0 votes
I have connected coordinator(XBee 1) to Arduino and Router(XBee 2) to the Soil moisture Sensor and want to send the analog sensor data to Coordinator from Router and then want it to display on Serial Monitor from Coordinator. I can see the Sensor analog data over Coordinator correctly but the Arduino code to display on serial monitor is not satisfactory. I am getting constant output on serial monitor . the value displayed is 16 16 16 16 ......

I am sharing the code. Can any one please help me with this project of mine?

ARDUINO CODE:

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
if (Serial.available() >= 21){
if(Serial.read() == 0x7E){
for (int i = 1; i<19; i++){
byte discardByte = Serial.read();
}
int analogMSB = Serial.read();
int analogLSB = Serial.read();
int analogReading = (analogLSB + (analogMSB * 256));
Serial.print(analogReading);


}

}
}
asked Feb 19 in RF Solutions and XBee by rkumar.ravi222 New to the Community (0 points)

Please log in or register to answer this question.

...