Announcement

Collapse
No announcement yet.

PHPoC Debugger screenshot for help (Thank's Khanh)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHPoC Debugger screenshot for help (Thank's Khanh)

    Hi Khanh, here is JPEG file about screenshot of PHPoC debugger

  • #2
    Dear Stéphane Mancini,

    I tested again, there maybe something missed in system file by accident.

    Could you please upgrade new system files via the below instruction:
    https://forum.phpoc.com/forum/phpoc-...phpoc-shield-1

    This also updates some new features from PHPoC Shield 2.

    After upgrading, please upload login.php file again and test it.

    Comment


    • #3
      • Hello Khanh. So, concerning the PHPoC debugger, I re-downloaded the 1.5.0 version (already installed) and copy all the files from GitHub phpoc-shield2. Concerning Arduino IDE, PHPoC library Version 1.5.0 is well installed. I use Arduino Mega board and PHPoC Shield 1 (P4S-348). Unfortunately, same issue. I have tried some PHPoC examples from Arduino IDE like WebRemotePad, Push and Slide and all three work well. Output Log from PHPoC,debugger displays only : PHPoC Shield / P4S-348 1.5.0. , nothing else. I also tried an other project find on youtube (https://www.youtube.com/watch?v=5n7WZFef4mY) with Arduino Uno, PHPoC Shield, Grove Camera and it works perfectly. I think there is no hardware issues. If you have other ideas to help me thank's. Regard's.

      Comment


      • #4
        Hello Stéphane Mancini,
        Now we can debug step by step. Firstly try to remove all camera and Google Oauth code on Arduino side

        Code:
        #include <Phpoc.h>
        #include <Arduino_JSON.h>
        
        // Replace your GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET here
        String GOOGLE_CLIENT_ID = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.app s .googleusercontent.com";
        String GOOGLE_CLIENT_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxx";
        PhpocServer websocket_server(80);
        
        int buttonState;
        int lastButtonState = LOW;
        unsigned long lastDebounceTime = 0;
        unsigned long debounceDelay = 50;
        
        
        void setup(){
        Serial.begin(115200);
        while(!Serial)
        ;
        
        Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
        websocket_server.beginWebSocket("login");
        Serial.print("WebSocket server address : ");
        Serial.println(Phpoc.localIP());
        
        pinMode(2, INPUT);
        
        }
        
        void loop(){
        PhpocClient client = websocket_server.available();
        
        if (client) {
        String ws_str = client.readLine();
        
        Serial.println(ws_str);
        }
        }
        Please compile and upload that code to Arduino, and then access login page in PHPoC Shield.
        The output in Serial Monitor should be like:
        log> sppc_begin: package 1.5.0
        log> sppc_begin: WiFi INFRA phpoc_wifi ch9
        log> sppc_begin: IPv4 192.168.0.234 255.255.255.0 192.168.0.1 8.8.8.8
        log> phpoc_server : listen 2/80
        WebSocket server address : 192.168.0.234
        google
        Please tell me the result and we can do the next step of debuging

        Comment


        • #5
          Hello Khanh,

          here is my IDE Serial Monitor display after downloading the code above in my Arduino Mega Board :


          log> sppc_begin: phpoc shield, firmware 1.5.0
          log> sppc_begin: package 1.5.0
          log> sppc_begin: WiFi INFRA pacsou ch1
          log> sppc_begin: IPv4 192.168.0.29 255.255.255.0 192.168.0.254 212.27.40.241
          log> phpoc_server : listen 2/80
          WebSocket server address : 192.168.0.29

          Comment


          • Khanh
            Khanh commented
            Editing a comment
            did you access login.php on PHPoC Shield before geting the above log ?

        • #6
          Hi, yes I can access login.php but always the same page where it is written Google, Login for Arduino with a rotating icon. However, I don't have a message asking me to reload the page.

          Comment


          • #7
            If so, there is no problem with network.
            Problem might be on Camera.
            In the original code, please add a Serial.println("debug point"); right after cameraInit(CT_JPEG, PR_160x120, JR_640x480); to check if this function block other operation or not?

            PS: I made this project not for commercial, therefore, the camera library may contain bugs that blocks operation in infinitive loop

            Comment


            • #8
              Hello Khanh, "debug point" appears in the IDE Serial Monitor if Serial.println("debug point") is added right after cameraInit(CT_JPEG, PR_160x120, JR_640x480). So Camera library seems good, no infinitive loop. But, quietly, I started all over again including the connections and a miracle begins to happen. When I reload the login.php page, now, Arduino board responds. Here is the IDE Serial Monitor display :

              log> sppc_begin: phpoc shield, firmware 1.5.0
              log> sppc_begin: package 1.5.0
              log> sppc_begin: WiFi INFRA pacsou ch1
              log> sppc_begin: IPv4 192.168.0.29 255.255.255.0 192.168.0.254 212.27.40.241
              log> phpoc_server : listen 2/80
              WebSocket server address : 192.168.0.29

              log> phpoc_server: connected 2
              log> phpoc_server : listen 3/80
              log> dns: query A accounts.google.com >> 216.58.215.45
              log> phpoc_client: connectSSL 0 >> success
              Connected to server
              log> phpoc_client: close 0 >> closed
              Invalid resonse from Google
              log> phpoc_client: close 2 >> closed
              log> phpoc_server: connected 3
              log> phpoc_server : listen 2/80
              log> dns: query A accounts.google.com >> 216.58.215.45
              log> phpoc_client: connectSSL 0 >> success
              Connected to server
              log> phpoc_client: close 0 >> closed
              Invalid resonse from Google


              And if i press the button to take a photo : "access_token is invalid, please login again" is displayed.

              What do you think about that ?

              Thank's Khanh
              Last edited by Stéphane Mancini; Today, 05:52 AM.

              Comment


              • #9
                That's great!

                Now problem is on google login.

                To find out the reason and solution, please read the following tutorials:These above article described how it work and how to do it. The first article does not use Arduino, but working principle is the same.

                And for debugging. In original Arduino code, lines 163 and 164 look like below
                Code:
                //Serial.println(response_hearder);
                //Serial.println(response_body);
                Uncomment these line to see the response from Google. You can know the reason why Google reject it, and then we can fix it.

                Comment

                Working...
                X