Now I rewrite the program of Sensor Side and remove the Xbee Shield,
just connect the following wire
Xbee <----> Arduino
Vin 3.3V
Dout RX0
Din TX0
GND GND
with following Code
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1);
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
{
Serial.begin(57600);
sensors.begin();
}
void loop(void)
{
sensors.requestTemperatures();
int tempA = sensors.getTempCByIndex(0);
Serial.print(tempA);
Serial.println();
delay (2000);
}
Also i reconfigure the Xbee
Coordinate End Device
CH = 11 CH = 11
ID =AAAA ID = AAAA
DH = 13A200 DH=13A200
DL=4081B858 DL = 4081B859
MY=0 MY=0
SH=13A200 SH= 13A200
SL=4081B859 SL= 4081B858
CE=1 CE=0
BD=6(57600) BD=6(57600)
Now, i can receive the temp from Sensor Side and show in X-CTU
(Please find the attachment)
i would like to improve my project,
i have 2 Arduino , 2 Xbee
if the sensor part arudino remain unchange,
the PC side change to a Arduino + Xbee
with the following code
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(57600);
Serial.println("Test");
mySerial.begin(57600);
}
void loop() // run over and over
{
mySerial.listen();
if (mySerial.available()>0)
{
Serial.println(mySerial.available());
delay(500);
}
}
I cant receive the temp at serial monitor
and just deplay the "Test"
and 5,5,5,5,10,10,10,,15,15.....63
((Please find the attachment)
how can i receive the temp
because i would like to use the temp to trigger the fan if the temperature too high
Serial Monitor.bmp (1.76 MB)
Temp with AT mode.bmp (694 KB)