 #define VERIFY 4
 #define CONNECTED 5
 #define SOFTPOT_THREASHOLD 950
+#define SOFTPOT_DELTA_THREASHOLD 111
 #define DELAY_IN_WAIT 1000000
 unsigned long session_id = 0xA90;
 

    if (softpotReading < SOFTPOT_THREASHOLD) {
      Serial.println("[INIT] Entering");      
      state = INIT;
    }
    selectedXBee = -1;
    break;

  case CONFIRM:
    // send out the signal to THE selected XBee
    // WAIT for the confirmation message to arrive
    state = CONNECTED;
    break;
  case VERIFY:
    // when there are multiple targets who have responded
    // one of the LED should be on at this case
    Serial.print("[VERIFY] now trying id=");
    Serial.println(selectedXBee);
    sendXBeePacketFromRaw(&XBee, XBeePacketArr[selectedXBee].id, "v", XBeePacketArr[selectedXBee].data);

    // configure the slider dynamically    
    delta_threshold = SOFTPOT_DELTA_THREASHOLD;
    changes = 0;
    if (XBeePacketCounter > 5) {
      // this happens really rare
      // you will only have 800 of the whole slider to use
      // then each step is 800/XBeePacketCounter
      delta_threshold = 800/XBeePacketCounter;
    }
    
    softpotReading = analogRead(softpotPin);
    if (softpotReading < SOFTPOT_THREASHOLD){
      // still in hold
      pressed = true;    
    }
     
    // should detect double click here:
    if (pressed == true && softpotReading > SOFTPOT_THREASHOLD) {
      // hand left, expected to have a tap
      last_release_time = millis();
      pressed = false;
      released = true;
    }
    if (released == true && softpotReading < SOFTPOT_THREASHOLD) {
      // detect if tapped again in a timely fashion
      unsigned long new_release_time = millis();
      if (new_release_time - last_release_time < 400) {
	// definitely timeout
	Serial.println("tap event detected");
	sendXBeePacketFromRaw(&XBee, XBeePacketArr[selectedXBee].id, "c", XBeePacketArr[selectedXBee].data);
	state = CONNECTED;	
      }      
    }     
    
    changes = (softpotReading - softpotInitV) / delta_threshold;
    selectedXBee += changes;
    
    break;
  case CONNECTED:

