 D4 - TEMP(DS18B20) /IN
 D3 - IR / OUT
 D2 - PIR /IN
- */
+*/
 
-#include <Wire.h> 
+
+
+
+#include <Wire.h>
 #include <OneWire.h>
 #include <DallasTemperature.h>
 #include <LiquidCrystal_I2C.h>
 #include <IRremote.h>
 
 //
-#define SETUP_IN_PIN A2;
-#define ENTER_IN_PIN 13;
-#define DN_IN_PIN    12;
-#define UP_IN_PIN    11;
+int SETUP_IN_PIN = A2;
+//int ENTER_IN_PIN = A0;
+int ENTER_IN_PIN = 13;
+int UP_IN_PIN    = 12;
+int DN_IN_PIN    = 11;
+
 //
-#define IR_IN_PIN    10;
-#define PIR_IN_PIN   2;
+int IR_IN_PIN    = 10;
+int PIR_IN_PIN   = 2;
 
-#define BZ_OU_PIN    9;
+int BZ_OU_PIN    =  9;
 
 // LCD
 LiquidCrystal_I2C lcd(0x27, 20, 4);
 
 // IR
+#define maxLen 800
+
+volatile  unsigned int irBuffer[maxLen]; //stores timings - volatile because changed by ISR
+volatile unsigned int x = 0; //Pointer thru irBuffer - volatile because changed by ISR
+
 IRrecv irrecv(IR_IN_PIN);
 IRsend irsend;
 

void setup()
{

// lcd
  lcd.init();
  lcd.backlight();
  lcd.clear();
  lcd.createChar(1, termometru);
  lcd.setCursor(0, 0);
  lcd.write(1);
// lcd
/
  Serial.begin (38400);
  Serial.println("TV controller Starting");
  delay(20);

  startMills = millis();

// pin mode

  pinMode(SETUP_IN_PIN, INPUT_PULLUP);
  pinMode(ENTER_IN_PIN, INPUT_PULLUP);
  pinMode(DN_IN_PIN, INPUT_PULLUP); 	
  pinMode(UP_IN_PIN, INPUT_PULLUP);
  pinMode(PIR_IN_PIN, INPUT_PULLUP)

  pinMode(BZ_OU_PIN, OUTPUT);  	

  digitalWrite(BZ_OU_PIN, LOW)


// temp
  sensors.begin();
  if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0"); 
  sensors.setResolution(insideThermometer, TEMPERATURE_PRECISION);
  sensors.requestTemperatures();
  tempCinside  = sensors.getTempC(insideThermometer);

long startMills;
long tv_startMills;

byte termometru[8] =
{
  B00100,
  B01010,
