 }
 
 bool connectWiFi() {
-	Serial.println("AT+CWMODE=1");
+	ESPComm.println("AT+CWMODE=1");
 	
 	String cmd = "AT+CWJAP=\"";
 	cmd += SSID;

		}
	}
	if(!connected){
		dbgSerial.println("[### Failed to connect to WiFi ###]");
		testFailed();
	}
	
	digitalWrite(LED, HIGH);
	delay(1000);	
	
	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(Serial.available()){
			dbgSerial.print((char) Serial.read());
		}
		delay(1);
	}


#define LED 13

SoftwareSerial ESPComm(11, 10); //Rx, Tx

void setup(){ 
	//Open ESPComm communication
	ESPComm.begin(9600);
	ESPComm.setTimeout(5000);
	
	Serial.begin(9600);
	Serial.println("\n\r[ESP8266 Interface Test]");
	
	pinMode(LED, OUTPUT);
	digitalWrite(LED, LOW);
	
	//Test if the module is ready
	ESPComm.print("AT\015\012");
	delay(2000);
	if(ESPComm.available())
	{
		Serial.println("Module is ready");
	}
	else
	{
		Serial.println("The module has not responded.");
		while(1);
	}
	
	if(ESPComm.find("OK")){
		Serial.println("[Module Responded OK]");
	}
	/* else {
		testFailed();
