 		}
 	}
 	if(!connected){
-		Serial.println("[### Failed to connect to WiFi ###]");
+		dbgSerial.println("[### Failed to connect to WiFi ###]");
 		testFailed();
 	}
 	
 	digitalWrite(LED, HIGH);
 	delay(1000);	
 	
-	Serial.println("[Set single connection mode]");
-	ESPComm.print("AT+CIPMUX=0\015\012");
-	
-	if(ESPComm.find("OK")){
-		Serial.println("[Module Responded OK]");
-	}
-	
-	Serial.println("[Requesting IP]");
-	ESPComm.print("AT+CIFSR\015\012");
+	dbgSerial.println("[Set single connection mode]");
+	Serial.print("AT+CIPMUX=0\015\012");
+	
+	if(Serial.find("OK")){
+		dbgSerial.println("[Module Responded OK]");
+	}
+	
+	dbgSerial.println("[Requesting IP]");
+	Serial.print("AT+CIFSR\015\012");
 	for(int i = 0; i < 500; ++i){
-		if(ESPComm.available()){
-			Serial.print((char) ESPComm.read());
+		if(Serial.available()){
+			dbgSerial.print((char) Serial.read());
 		}
 		delay(1);
 	}

	cmd += "\"";
	cmd += "\015\012";
	
	Serial.println(cmd);
	ESPComm.print(cmd);
	
	if(ESPComm.find("OK")) {
		Serial.println("[Connected to WiFi]");
		return true;
	}
	else {
		Serial.println("[# Failed to connect to Wifi #]\n");
		return false;
	}

}

void testFailed(){
	Serial.println("[### Previous Test Failed ###]");
	while(1);
}

  String cmd = "AT+CIPSTART=\"TCP\",\"";
  cmd += DST_IP;
  cmd += "\",80";
  Serial.println(cmd);
  dbgSerial.println(cmd);
  if (Serial.find("Error")) return;
  cmd = "GET / HTTP/1.0\r\n\r\n";
  Serial.print("AT+CIPSEND=");
  Serial.println(cmd.length());
  if (Serial.find(">"))
  {
    dbgSerial.print(">");
  } else
  {
    Serial.println("AT+CIPCLOSE");
    dbgSerial.println("connect timeout");
    delay(1000);
    return;
  }
  Serial.print(cmd);
  delay(2000);
  //Serial.find("+IPD");
  while (Serial.available())
  {
    char c = Serial.read();
    dbgSerial.write(c);
    if (c == '\r') dbgSerial.print('\n');
  }
  dbgSerial.println("====");
  delay(1000);
*/	
  
	
	/*
	dbgSerial.println("[Prompting for available networks]");
	Serial.print("AT+CWLAP\015\012");
	*/
	
	//Command prompt to send commands to ESP module
	/*
	while(1){
		if(Serial.available()){
			dbgSerial.print((char) Serial.read());
		}
		
		if(dbgSerial.available()){
			Serial.print((char)dbgSerial.read());
		}
	}
	*/
