 #include <RCSwitch.h> // https://code.google.com/p/rc-switch/
 #include <PinChangeInt.h>
 
-RCSwitch rf = RCSwitch();
-ISR(WDT_vect) {Sleepy::watchdogEvent();}  // Setup for low power waiting
+long sensorId = 11;         // sensor identifier - from 1 to 99
+long sensorAlertCode = 1;  // value send by sensor from 1 to 99999
 
-int calibrationTime = 10;        //the time we give the sensor to calibrate (10-60 secs according to the datasheet)
-int rfPacketsToSend = 10; 
+int rfAlertCode = 1;     // must be in 24 bit so max 16777215 , should containd sensor id sensor value 
+int calibrationTime = 12;  //the time we give the sensor to calibrate (10-60 secs according to the datasheet)
+int rfPacketsToSend = 7;   // to be sure message is received I send messge few times
 
 // Pins
 int PIR = 2;

}

void loop() {
  int ll = HIGH;
  digitalWrite(RFPOWER, HIGH);// wlacz zasilanie w rf
  delay(100);
  Serial.println("Motion detected");
  for (int i = 0; i < rfPacketsToSend; i++)
  {
    Serial.print(".");
    rf.send(rfAlertCode, 24);
    digitalWrite(LED, ll);
    ll = ll == HIGH ? LOW : HIGH;
  }
  digitalWrite(RFPOWER, LOW); // wylacz rf
  Serial.println("");
  
  Sleepy::powerDown();
}

void wakeUp() {}

void CalibratePirSensor()
{
  int ll = HIGH;
  Serial.println("Calibrating PIR sensor ");
  for (int i = 0; i < calibrationTime; i++) {
    Serial.print(".");
    delay(1000);
    digitalWrite(LED, ll);
    ll = ll == HIGH ? LOW : HIGH;
  }
  Serial.println("");
  Serial.println("Sensor active");
  digitalWrite(LED, LOW);
  delay(50);
}


int RFTX = 9;   
int RFPOWER = 8;// do tranzystora

RCSwitch rf = RCSwitch();
ISR(WDT_vect) {Sleepy::watchdogEvent();}  // Setup for low power waiting

void setup() {
  Serial.begin(9600);
