I’m running sensor network with base station (which consists of XBee Explorer and XBee Series 2) and two sensor nodes (each one consists of Arduino Mega, Wireless Proto Shield, XBee Series 2 and temperature sensor TMP102). I’m using this code for each node:
#include <Wire.h>
int tmp102Address = 0x48;
void setup(){
Serial.begin(9600);
Wire.begin();
}
void loop(){
float celsius = getTemperature();
Serial.print("NODE 1");
Serial.print("\n");
Serial.print("Celsius: ");
Serial.println(celsius);
delay(7000);
}
float getTemperature(){
Wire.requestFrom(tmp102Address,2);
byte MSB = Wire.read();
byte LSB = Wire.read();
int TemperatureSum = ((MSB << 8) | LSB) >> 4;
float celsius = TemperatureSum*0.0625;
return celsius;
}
The serial monitor displays correctly the data from each node when I chose the appropriate serial port. But when I’m using serial monitor for the base station port there are strange received symbols between sensors’ data:
I appreciate any help!