Sei sulla pagina 1di 3

void Response_Client(void)

{
if (strstr(g_arrui8ESP8266Buf,"HTTP") != NULL)
{ Control_Led();
USART_puts(USART3,"MODE We have a Client!\n");
Var_Response=ESPWriteIndex;
//sprintf(transmitdata9, "<p align=\"center\"> <img
src=\"https://upload.wikimedia.org/wikipedia/vi/c/cd/Logo-hcmut.svg\" width=\"10%\"
height=\"10%\"> </p>");
sprintf(transmitdata1, "<div align=\"center\"><img
src=\"https://upload.wikimedia.org/wikipedia/vi/c/cd/Logo-hcmut.svg\" width=\"10%\"
height=\"10%\" align=\"center\"><p> Ho Chi Minh City University Of Techlonogy
</p></div>");
sprintf(transmitdata2, "<p align=\"center\"> Faculty of Electrical &
Electronics Engineering </p>");
sprintf(transmitdata3, "<p align=\"center\"> Division of Electronics Engineering
</p>");
sprintf(transmitdata4, "<p align=\"center\">GRADUATION THESIS</p>");
sprintf(transmitdata5, "<p align=\"center\"><i>Subject: Surveying
Robot</i></p><BR><BR>");
sprintf(transmitdata6, "<p align=\"center\"><u>Data
Collection</u>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&em
sp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<u>Motor
Control</u></p>");
//sprintf(transmitdata7, "<p align=\"center\">Socket #4 <a
href=\"socket4On\"><button>ON</button></a><a
href=\"socket4Off\"><button>OFF</button></a></p>");
sprintf(transmitdata7, "<p align=\"left\" style=\"text-indent:25em;\">
&#149;Temperature: %d&#176;C
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp
;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; <a
href=\"socket4On\"><button>Forward</button></a></p> <p align=\"left\" style=\"text-
indent:25em;\"> &#149;Huminity: %d&#37;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"socket4On\"><button>Left</button></a>&ensp;<a
href=\"socket4On\"><button>Stop</button></a>&ensp;<a
href=\"socket4On\"><button>Right</button></a></p><p align=\"left\" style=\"text-
indent:25em;\"> &#149;Distance: %d cm
&ensp;&ensp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp
;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"socket4On\"><button>Back</button></a></p>",data[2],data[0],Var_Dis);
strcpy(transmitdata, transmitdata1);
strcat(transmitdata, transmitdata2);
strcat(transmitdata, transmitdata3);
strcat(transmitdata, transmitdata4);
strcat(transmitdata, transmitdata5);
strcat(transmitdata, transmitdata6);
strcat(transmitdata, transmitdata7);
// strcat(transmitdata, transmitdata8);
//strcat(transmitdata, transmitdata9);
//strcat(transmitdata, transmitdata10);
length=strlen(transmitdata);
sprintf(transmitconf,"AT+CIPSEND=0,%d\r\n",length);
Clear_ESPBuffer();
ESPWriteIndex=0;
USART_puts(USART1,transmitconf);
Clear_ESPBuffer();
ESPWriteIndex=0;
Delay(2000000L);
USART_puts(USART1,transmitdata);
Delay(2000000L);
USART_puts(USART1,"AT+CIPCLOSE=0\r\n");
Clear_ESPBuffer();
ESPWriteIndex=0;
}

void Response_Client(void)
{
if (strstr(g_arrui8ESP8266Buf,"HTTP") != NULL)
{ Control_Led();
USART_puts(USART3,"MODE We have a Client!\n");
Var_Response=ESPWriteIndex;
sprintf(transmitdata1, "<div align=\"center\"><img
src=\"https://upload.wikimedia.org/wikipedia/vi/c/cd/Logo-hcmut.svg\" width=\"10%\"
height=\"10%\" align=\"center\"><p> Ho Chi Minh City University Of Techlonogy
</p></div>");
sprintf(transmitdata2, "<p align=\"center\"> Faculty of Electrical &
Electronics Engineering </p>");
sprintf(transmitdata3, "<p align=\"center\"> Division of Electronics Engineering
</p>");
sprintf(transmitdata4, "<p align=\"center\">GRADUATION THESIS</p>");
sprintf(transmitdata5, "<p align=\"center\"><i>Subject: Surveying
Robot</i></p><BR><BR>");
sprintf(transmitdata6, "<p align=\"center\"><u>Data
Collection</u>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<u>
PWM</u>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<u>Motor Control</u></p>");

sprintf(transmitdata7, "<p align=\"left\" style=\"text-indent:25em;\">


&#149;Temperature: %d&#176;C
&ensp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"pwm25\"><button>25&#37;</button></a>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ems
p;&emsp; <a href=\"forward\"><button>Forward</button></a></p> <p align=\"left\"
style=\"text-indent:25em;\"> &#149;Huminity: %d&#37;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"pwm50\"><button>50&#37;</button></a>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"left\"><button>Left</button></a>&ensp;<a
href=\"stop\"><button>Stop</button></a>&ensp;<a
href=\"right\"><button>Right</button></a></p><p align=\"left\" style=\"text-
indent:25em;\"> &#149;Distance: %d cm
&ensp;&ensp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"pwm75\"><button>75&#37;</button></a>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ems
p;&emsp;&emsp;<a
href=\"back\"><button>Back</button></a></p>",data[2],data[0],Var_Dis);
strcpy(transmitdata, transmitdata1);
strcat(transmitdata, transmitdata2);
strcat(transmitdata, transmitdata3);
strcat(transmitdata, transmitdata4);
strcat(transmitdata, transmitdata5);
strcat(transmitdata, transmitdata6);
strcat(transmitdata, transmitdata7);
length=strlen(transmitdata);
sprintf(transmitconf,"AT+CIPSEND=0,%d\r\n",length);
Clear_ESPBuffer();
ESPWriteIndex=0;
USART_puts(USART1,transmitconf);
Clear_ESPBuffer();
ESPWriteIndex=0;
Delay(2000000L);
USART_puts(USART1,transmitdata);
Delay(2000000L);
USART_puts(USART1,"AT+CIPCLOSE=0\r\n");
Clear_ESPBuffer();
ESPWriteIndex=0;
}

sprintf(transmitdata1, "<div align=\"center\"><img


src=\"https://upload.wikimedia.org/wikipedia/vi/c/cd/Logo-hcmut.svg\" width=\"10%\"
height=\"10%\" align=\"center\"><p> Ho Chi Minh City University Of Techlonogy
</p></div>");
sprintf(transmitdata2, "<p align=\"center\"> Faculty of Electrical &
Electronics Engineering </p>");
sprintf(transmitdata3, "<p align=\"center\"> Division of Electronics Engineering
</p>");
sprintf(transmitdata4, "<p align=\"center\">GRADUATION THESIS</p>");
sprintf(transmitdata5, "<p align=\"center\"><i>Subject: Surveying
Robot</i></p><BR><BR>");
sprintf(transmitdata6, "<p align=\"center\"><u>Data
Collection</u>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<u>
PWM</u>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<u>Motor Control</u></p>");

sprintf(transmitdata7, "<p align=\"left\" style=\"text-indent:25em;\">


&#149;Temperature: %d&#176;C
&ensp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"pwm25\"><button>25&#37;</button></a>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ems
p;&emsp; <a href=\"forward\"><button>Forward</button></a></p> <p align=\"left\"
style=\"text-indent:25em;\"> &#149;Huminity: %d&#37;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"pwm50\"><button>50&#37;</button></a>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"left\"><button>Left</button></a>&ensp;<a
href=\"stop\"><button>Stop</button></a>&ensp;<a
href=\"right\"><button>Right</button></a></p><p align=\"left\" style=\"text-
indent:25em;\"> &#149;Distance: %d cm
&ensp;&ensp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a
href=\"pwm75\"><button>75&#37;</button></a>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ems
p;&emsp;&emsp;<a
href=\"back\"><button>Back</button></a></p>",data[2],data[0],Var_Dis);