Finally got a chance to play with the XBees, I reprogrammed them with custom channels and gave them new ID's etc. Very straight forward with the X-CTU software, very happy so far XD.
I decided to start from square one and run a few simple experiments to get a better handle on how this all works. the first thing I did was load a code to make a LED turn on with the press of the 1 and 2 keys on a keyboard.
This code works while tethered to a USB cable (COM5)
I then hooked up one of the XBees to the Arduino using pins 0 & 1 (RX & TX) and the code worked flawlessly (COM6) [ :. Really cool by the way :. ]
But I can't for the life of me figure out how to get the RX and TX to move over to pins 2 & 13 where I need them to be, much less both serials to work in the same code (The end goal).
Here's what I have been playing with, only I have tried several variations all without too much in the way of progress:
#include <SoftwareSerial.h>
void setup() {
Serial.begin(9600); // Setup Serial library at 9600 bps
SoftwareSerial mySerial = SoftwareSerial(2, 13);
mySerial.begin(9600); // Setup Serial library at 9600 bps
}
void loop() {
// read the IO:
if (Serial.available() > 0) {
int inByte = Serial.read();
for (int thisPin = 9; thisPin < 11; thisPin++) {
pinMode(thisPin, OUTPUT);
switch (inByte) {
//Pin 9 - Lights
case '1':
digitalWrite(9, HIGH); // Turns on Lights
break;
case '2':
digitalWrite(9, LOW); // Turns off Lights
break;
default:
// turn all the connections off:
for (int thisPin = 9; thisPin < 11; thisPin++) {
digitalWrite(thisPin, LOW);
}
}
}
}
}
Thanks,
Ec7