 {
     irrecv.enableIRIn(); // Start the receiver
     pinMode(BUTTON_PIN, INPUT);
-    pinMode(STATUS_PIN, OUTPUT);
     Serial.begin(9600);
     
     // Initialize WiServer and have it use the sendMyPage function to serve pages
     pinMode(ledPin1, OUTPUT);
-    pinMode(ledPin2, OUTPUT);
+    pinMode(RECV_PIN, INPUT);
+    pinMode(BUTTON_PIN, INPUT);
   
     //WiFi.init();
     WiServer.init(sendPage);
     WiServer.enableVerboseMode(true);
     states[0] = false;
-    states[1] = false;
     Serial.println("Started webserver ...");
 }
 
 void printStates()
 {
-        for (stateCounter = 0 ; stateCounter < 2; stateCounter++)
+        for (stateCounter = 0 ; stateCounter < 1; stateCounter++)
         {
             boolToString(states[stateCounter], stateBuff);
            

    codeValue = results->value;
    codeLen = results->bits;
  }
}

void sendCode(int repeat) {
  if (codeType == NEC) {
    if (repeat) {
      irsend.sendNEC(REPEAT, codeLen);
      Serial.println("Sent NEC repeat");
    } 
    else {
      irsend.sendNEC(codeValue, codeLen);
      Serial.print("Sent NEC ");
      Serial.println(codeValue, HEX);
    }
  } 
  else if (codeType == SONY) {
    irsend.sendSony(codeValue, codeLen);
    Serial.print("Sent Sony ");
    Serial.println(codeValue, HEX);
  } 
  else if (codeType == RC5 || codeType == RC6) {
    if (!repeat) {
      // Flip the toggle bit for a new button press
      toggle = 1 - toggle;
    }
    // Put the toggle bit into the code to send
    codeValue = codeValue & ~(1 << (codeLen - 1));
    codeValue = codeValue | (toggle << (codeLen - 1));

#include <WiServer.h>
#include <IRremote.h>

int RECV_PIN = 5;
int BUTTON_PIN = 6;

IRrecv irrecv(RECV_PIN);
IRsend irsend;
