Maybe I'm missing something here, but the remote XBee doesn't have a ledPIN.
the xbee does not have an ledPIN, but i do have a switch attached to pin0 on the remote xbee and pin0 on the coordinator xbee's pin0 is connected to the arduino's pin2
here's the code
#include <XBee.h>
const int buttonPin = 2; // the pin that the pushbutton is attached to via xbee coordinator PIN 0
const int ledPin = 13; // output to LED
int rowPinA = 4;
int rowPinB = 5;
int rowPinC = 6;
int colPin1 = 8;
int colPin2 = 9;
int colPin3 = 10;
int colPin4 = 11;
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0;
void setup() {
Serial.begin(9600);
pinMode(rowPinA, OUTPUT);
pinMode(rowPinB, OUTPUT);
pinMode(rowPinC, OUTPUT);
pinMode(colPin1, OUTPUT);
pinMode(colPin2, OUTPUT);
pinMode(colPin3, OUTPUT);
pinMode(colPin4, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop()
{
buttonState = digitalRead(buttonPin);
//Serial.println(buttonState);
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
buttonPushCounter++;
Serial.print("number of button pushes: ");
Serial.println(buttonPushCounter);
}
else {
}
}
lastButtonState = buttonState;
if (buttonPushCounter % 4 == 0) {
digitalWrite(ledPin, LOW);
} else {
digitalWrite(ledPin, HIGH);
}
if (Serial.available() > 0) {
int inByte = Serial.read();
switch (inByte) {
case '1':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin1, HIGH); //1
digitalWrite(rowPinA, HIGH); //colb
digitalWrite(rowPinB, HIGH);//colc
break;
case '2':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin1, HIGH); //c2
digitalWrite(rowPinA, HIGH); //colb
digitalWrite(rowPinC, HIGH);//cold
break;
case '3':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin1, HIGH); //3
digitalWrite(rowPinB, HIGH);//colc
digitalWrite(rowPinC, HIGH);//cold
break;
case '4':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin2, HIGH);//4
digitalWrite(rowPinA, HIGH); //colb
digitalWrite(rowPinB, HIGH);//colc
break;
case '5':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin2, HIGH);//5
digitalWrite(rowPinA, HIGH); //colb
digitalWrite(rowPinC, HIGH);//cold
break;
case '6':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin2, HIGH);//6
digitalWrite(rowPinB, HIGH);//colc
digitalWrite(rowPinC, HIGH);//cold
break;
case '7':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin3, HIGH);//7
digitalWrite(rowPinA, HIGH); //colb
digitalWrite(rowPinB, HIGH);//colc
break;
case '8':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin3, HIGH);//8
digitalWrite(rowPinA, HIGH); //colb
digitalWrite(rowPinC, HIGH);//cold
break;
case '9':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin3, HIGH);//9
digitalWrite(rowPinB, HIGH);//colc
digitalWrite(rowPinC, HIGH);//cold
break;
case 'a':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin4, HIGH); //10
digitalWrite(rowPinA, HIGH); //colb
digitalWrite(rowPinB, HIGH);//colc
break;
case 'b':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin4, HIGH); //11
digitalWrite(rowPinA, HIGH); //colb
digitalWrite(rowPinC, HIGH);//cold
break;
case 'c':
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
digitalWrite(colPin4, HIGH); //12
digitalWrite(rowPinB, HIGH);//colc
digitalWrite(rowPinC, HIGH);//cold
break;
default:
digitalWrite(colPin1, LOW); //col
digitalWrite(colPin2, LOW);
digitalWrite(colPin3, LOW);
digitalWrite(colPin4, LOW);
digitalWrite(rowPinA, LOW); //colb
digitalWrite(rowPinB, LOW);//colc
digitalWrite(rowPinC, LOW);//cold
}
}
}
"coordinator" and "end point" are terms that make sense only for Series 2 (mesh network) models. You claim to be using Series 1 models.
well the terms coordinator and end point are certainly options in the newest version of XCTU and whether they affect the flow of data or not I don't know for sure but I can assure you that they are not arbitrary labels. In XCTU when you attach to the coordinator directly to the pc with XCTU you have the ability to adjust the settings of all of the end point xbees from the GUI. You can identify but not change the xbees if you are connected directly with an end point.
That depends on how the XBee is connected to the Arduino. If you are using a rubber band or duct tape, no. If you are using a shield, maybe. Or maybe not. Depends on the shield, and possibly switch or jumper settings.
the coordinator xbee is connected to the arduino on the tx/rx pins (0 and 1), also pin0 of the coordinator is connected directly to pin2 of the arduino. that's it.
Exactly.
i'll have at least 12 remote xbees that could be transmitting 'push button' data to to the central unit via xbee pin0. currently all of the push button data is being read by the arduino by digitalRead on pin 2, regardless of which xbee remote sends data. i'm not getting any identifying data that i can access on the remote pin0=>pin2 arduino stream. if the header data is coming over the tx/rx link then iwill need to either find a way to accurastely associate the 'pin0=>pin2' data with the correct 'MY ID' data even when multiple xbees are sending data, so would have to have some sort of associative reference whether it's a time stamp, header etc.
or i could completely change the code if makes more sense.