Page 23 - MDP2022-2
P. 23

if  (WiFi.status()  ==  WL_CONNECTED)  {
                    String  phpHost  =  "http://"  +  host  +  "/sendESP.php?uid_value="  +  hexString;
                    Serial.print("Connect  to  ");
                    Serial.println(phpHost);
                    http.begin(client,  phpHost);
                    http.setTimeout(1000);
                    int  httpCode  =  http.GET();
                    if  (httpCode  >  0)  {
                        Serial.printf("GET  code  :  %d\n\n",  httpCode);
                        String  payload  =  http.getString();
                        if  (payload.indexOf("OK")  ==  0)  {  //UID값이  저장  되어있다면
                            mp3_play(3);
                            Serial.println("sate  data");
                            lcd.setCursor(4,  0);
                            lcd.print("                              ");
                            lcd.setCursor(4,  0);
                            lcd.print("OK  SAVE  YOU  DATA");
                            lcd.setCursor(6,  1);
                            lcd.print("                  ");
                            lcd.setCursor(6,  1);
                            lcd.print(score);


                            String  phpHost  =  "http://"  +  host  +  "/temp.php?uid_value="  +  hexString  +  "&score="  +
            String(score);
                            Serial.print("Connect  to  ");
                            Serial.println(phpHost);
                            http.begin(client,  phpHost);
                            http.setTimeout(1000);
                            int  httpCode  =  http.GET();
                            if  (httpCode  >  0)  {
                                Serial.printf("GET  code  :  %d\n\n",  httpCode);
                                if  (httpCode  ==  HTTP_CODE_OK)  {
                                    String  payload  =  http.getString();
                                    Serial.println(payload);
                                }
                            }
                            else  {
                                Serial.printf("GET  failed,  error:  %s\n",  http.errorToString(httpCode).c_str());
                            }
                            http.end();
                        }


                        else  if  (payload.indexOf("OK")  !=  0)  {  //UID값이  저장이  안돼어  있다면
                            mp3_play(4);
                            Serial.println("view  uid");
   18   19   20   21   22   23   24   25   26   27   28