 /*
  * SxXBee2.ino
  *
+ *  Changed on: 12.10.2015   new protocol rev1.1
+ *  Changed on: 04.09.2015   broadcast of power state
  *  Created on: 28.08.2015
- *  Changed on: 30.08.2015
- *  Changed on: 04.09.2015   broadcast of power state
- *  Changed on: 26.09.2015   new wording: SX22b class
+ *  
+ *
  *  Author and Copyright: Michael Blank
  *
  *  reads date from xbee and sends them to SX Bus
  *
  *  !!! SX lib does not work with SoftwareSerial Lib !!!
  *
- *  benötigte Hardware:
- *     SX-Basisplatine von R.Thamm 
+ *  Hardware: SX-Basisplatine von R.Thamm 
  *     + Xbee an RX/TX des Arduino Pro Mini
- *  siehe http://opensx.net/funkregler/basisstation-xbee-platine
  */
 
 
 #include <SX22b.h>   // this is the Selectrix library
-#include <SX22Command.h>   // this is the Selectrix Command library
+#include <SXCommand.h>   // this is the Selectrix Command library
 #include <XBee.h> // XBee library by Andrew Rapp
 
 #define LED  13   // LED indicator at pin 13
 
 SX22b sx;                // selectrix library
-SX22Command sxcmd;      // holds command data
+SXCommand sxcmd;      // holds command data
 
 static int ledState = LOW;
 static byte oldSx[MAX_CHANNEL_NUMBER];

            char c = rx.getData(i);
            s += c;
         }

         // interpret SX command from XBee
         int n= s.indexOf(' '); // command split by space
         // example:  "44 31" = set loco #44 to speed 31,
         //                forward, Light=off, F=off
         //       (standard selectrix data format, 8 bit)
         if (n != -1) {
            String ch = s.substring(0,n);
            int i_ch = ch.toInt();
            String s2 = s.substring(n+1,s.length());
            int i_value = s2.toInt();
            do {
 		delay(10);
            } while (sx.set(i_ch,i_value));  // send to SX bus

         }
         digitalWrite(LED,LOW);  // indicate stop of send to SX Bus

*/
void setup() {

    Serial.begin(9600);      // for comm with xbee - TODO increase to 57600
    pinMode(LED,OUTPUT);     // indicator for rec. packet
    xbee.setSerial(Serial);
    broadcast64 = XBeeAddress64(0, 0x0000FFFF);  //broadcast address
