I have two XBee S2 that I just recently got as a gift. What I'm trying to do with them is send a command from the X-CTU terminal using a XBee connected to my computer to a XBee connected to my arduino and turn an LED on or off. I know the XBees are communicating because if I put a simple counter the arduino, the numbers show up in the terminal window.
int led = 9; //Pin LED is connected to
int ledStatus = 0; //Interger used to tell pin what to do
void setup()
{
Serial.begin(9600);
pinMode(led,OUTPUT);
}
void loop()
{
if(Serial.available() > 0) //Make sure bytes are in the serial buffer
{
ledStatus = Serial.read(); //Write bytes to int ledStatus
analogWrite(led, ledStatus); //Output ledStatus to LED pin
}
}
When I run this, the LED just stays off