I'm pretty new to the whole tinker community so bear with me, please.
I have two arduino r3's with PIR motion sensors turning on an led when they detect something. They also both write to serial with is attached to my xbee series 2 chips. They are both setup as AT Routers with the destination high and low set to the coordinator and the pan address set to 0 which is what I have it as on the coordinator. The coordinator is plugged into a usb dongle that is monitored by xctu.
The setup seems to work intermittently. When i check the terminal in x-ctu i get messages every once in a while with a little junk attached to it.
EX:
[email protected] ended!
..~.
[email protected][email protected] detected!
.W~.
[email protected][email protected]".......
..~.
[email protected][email protected][email protected]!
./~.#[email protected] 1 Starting up!
[email protected]!
[email protected] Motion ended!
[email protected] 2 Motion ended!
..~.'[email protected] 2 Motion detected!
[email protected] 2 Motion ended!
Here is the code for the two arduinos:
Code: Select all
/* Basic XBEE Communication Test */
//Settings
int sigLED = 11;
int sigPIR = 2;
int pirStatus = 0;
int motionFlag = LOW;
void setup(){
Serial.begin(9600);
pinMode(sigLED, OUTPUT);
pinMode(sigPIR, INPUT);
Serial.println("Sensor 1 Starting up!");
}
void loop(){
//Check PIR
pirStatus = digitalRead(sigPIR);
//Light LED and Signal, or don't
if (pirStatus == HIGH){
digitalWrite(sigLED, HIGH);
if(motionFlag == LOW){
Serial.println("Sensor 1 Motion detected!");
motionFlag = HIGH;
}
}
else{
digitalWrite(sigLED, LOW);
if(motionFlag == HIGH){
Serial.println("Sensor 1 Motion ended!");
motionFlag = LOW;
}
}
}
the code is the same on both except for the messages say sensor 1 and sensor 2.
The messages are really rather infrequent.
Anyways, if someone has any inclination as to what might be the problem i'd really appreciate some advice. If you need more information, please let me know and i'll add it. There are a ton of settings I don't touch in x-ctu, but what i did change are as follows:
Coordinator:
Updated and set to api coordinator
pan id = 0
Router 1:
updated and set to at router
set pan id to 0
set DH to 0013A200
set DL to 408B2D78
Router 2:
Router 1:
updated and set to at router
set pan id to 0
set DH to 0013A200
set DL to 408B2D78