 volatile int green_state = LOW;
 
 //access point should only work for b and g
-char ssid[] = "nsynapse";
+char ssid[] = "hellfire";
 char password[] = "elec6887";
-WiFiClient client;
 WiFiServer server(8000);
 WiFiUDP Udp;
 

    //////////////////////// service announce
    case ANNOUNCE: 
    {
      connect_led();
      if(root)
      {
        Udp.beginPacket(DEFAULT_UDP_MEMBERSHIP, DEFAULT_UDP_PORT);
        Udp.write(aJson.print(root));
        Udp.endPacket();
        process_state++;
      }
    }
    break;
    
    case ANNOUNCE+1:
    {
      if(client) {
        process_state=SERVICE;
        digitalWrite(YELLOW_LED, HIGH);
      }
      else {
        process_state = ANNOUNCE;
        delay(1000);
      }
    }
    break;
    
    //////////////////////// service run
    case SERVICE:
    { 
      if(client) {
        while(client.connected()) {
          digitalWrite(RED_LED, HIGH);
        }
        client.stop();
        digitalWrite(RED_LED, LOW);
        process_state = IDLE;
      }
    }
    break;
  }
 
  /*
  int i=0;
  client = server.available();
  
  int push1_state = LOW;
  int prev_push1_state = LOW;
  int push2_state = LOW;
  int prev_push2_state = LOW;
  
  unsigned char btn = 0x00;
  unsigned char btn_value = 0x00;
  
  
  
  if(client) 
  {
    Serial.println("New client is connected.");
    //send(btn, btn_value);
    
    while(client.connected()) 
    {
      digitalWrite(YELLOW_LED, HIGH);
      
      push1_state = digitalRead(PUSH1);
      push2_state = digitalRead(PUSH2);
      
      if(push1_state!=prev_push1_state) {
        if(push1_state==HIGH) {
          Serial.println("Push1 High");
          send(PUSH1, HIGH);
        }
        else if(push1_state==LOW) {
          Serial.println("Push1 Low");
          send(PUSH1, LOW);
        }
      }
      
      if(push2_state!=prev_push2_state) 
      {
        if(push2_state==HIGH) {
          Serial.println("Push2 High");
          send(PUSH2, HIGH);
        }
        else if(push2_state==LOW) {
          Serial.println("Push2 Low");
          send(PUSH2, LOW);
        }
      }
      
      prev_push1_state = push1_state;
      prev_push2_state = push2_state;
      
      delay(10);
    }
    Serial.println("Client disconnected");
    client.stop();
  }
  
  delay(300);*/
}



enum {IDLE = 0, ANNOUNCE=100, SERVICE=200 };
unsigned int process_state = IDLE;

aJsonObject* announce = aJson.createObject();
aJsonObject* frame = aJson.createObject();

void setup()
{
