-->
Page 1 of 1

Module is blocking!

PostPosted: Fri Jan 30, 2015 1:01 pm
by costycnc
This small code work fine , but if not wait until command Serial.println("AT+CIPCLOSE=0"); is execute (when click button 2 consecutive times on web page module no responding,is blocking).
When attemp for Serial.println("AT+CIPCLOSE=0"); is executed (i know but led blue blinking what is executed :) ) i'ts work normally.
Code: Select allbyte b;

void setup()
{
   pinMode(13, OUTPUT);
   
  Serial.begin(9600);
//------------------------- INITIALISE ESP8266 MODULE ----------------------
  Serial.println("AT+RST");
  delay(2000);

  Serial.println("AT+CIPMUX=1");
  delay(2000);

  Serial.println("AT+CIPSERVER=1,80");
  delay(2000);
// ------------------END INITIALISE ---------------------------------------------
}

void loop()

  // -------- IF STRING RECEIVE CONTAIN "+IPD"--------------
getch();
if (b==43){// +
getch();
if (b==73){// I
getch();
if (b==80){ //P
getch();
if (b==68){// D
getch();
getch();
getch();
getch();
getch();
getch();
getch();
getch();
getch();
getch();
getch();
getch();
getch();
// -------IF AFTER "GET/" IS "A" ("GET/A")-----
if (b==65){ //caracter A
digitalWrite(13, HIGH);//LED ON OF ARDUINO
  }
 // -------IF AFTER "GET/" IS "B" ("GET/B")-----
  else if (b==66){ //caracter B
  digitalWrite(13, LOW);//LED OFF ON ARDUINO
  }
  //-----------------ALWAIS SEND THIS HTML PAGE---------------------
Serial.println("AT+CIPSEND=0,168");
delay(2000);
Serial.println("<html><h1>Pagina uficiale famiglia BOBOACA</h1><br><a href='A'><button type='button'>LED ON!</button></a><a href='B'><button type='button'>LED OFF!</button></a></html>");// 167+1
delay(2000);
//-----------AND CLOSE CONNECTION------------------------------
Serial.println("AT+CIPCLOSE=0");
  }
  }
  }
  }
  }

void getch(){
    if(Serial.available()){
     delay(50);
    b = Serial.read();
  }
  }
 

Thanks in advanced ! Already i read some topics here and have not seen something similar to my problem.
And if we have not seen, I apologize !
Thanks!