🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    ESP 32 and ESP 8266 libs

    FAQS
    3
    18
    50.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Kryten
      last edited by

      @JimiT
      Hi JimiT

      Yes, I just tried to do the regular WiFi.begin(ssid,pwd) and that worked great.
      I made it work. (jay me!)

      Change in code:
      the setup was wrong (original code):

      void setup() {
      m5.begin();
      preferences.begin("wifi-config");

      delay(10);
      if (restoreConfig()) {
      if (checkConnection()) {
      settingMode = false;
      startWebServer();
      return;
      }
      }
      settingMode = true;
      setupMode();
      }

      My correction:
      void setup() {
      m5.begin();
      preferences.begin("wifi-config");

      delay(10);
      if (restoreConfig()) {
      if (checkConnection()) {
      settingMode = false;
      startWebServer();
      return;
      } else {
      settingMode = true;
      setupMode();
      }
      }
      }

      Missing code tags..
      Basically the setup was connection but since the settingMode = true and setupMode() is added after we try to connect. It jumps out of connection mode.

      And do you have a link to Mario Bros?

      JJJ 1 Reply Last reply Reply Quote 0
      • JJJ
        JJ @Kryten
        last edited by

        @kryten
        Hey thanks that looks like nice work...

        I updated the sketch with your suggestion and it compiled correctly..... I did get it to connect successfully to the internet and got to the STA page. Excellent.

        However before I got that to work I had another issue as my password contained a pipe ( | ) symbol, which was not being transferred to the URL link correctly (perhaps as it wasn't on the list at the bottom of the sketch - String urlDecode).

        Anyway, ultimately I changed the wifi password to remove the pipe & the correct password was then being fed into the url when I enter in the password.... & correct password & SSID on M5Stack screen.

        Unfortunately after reloading the revised sketch it has gone back to "timing out" despite reflashing again using "pong"and then re-loading the revised sketch....

        Curious ? Seems I will need to work on it a bit more. Worked b4 though !

        RE. Mario Bros..... For me, this sketch came loaded when i bought the FACES modules (which includes a core unit). However you can get the NES_EMU software from github but from what it says you will need a copy of the ROM file. Have not tried loading it myself.
        https://github.com/m5stack/M5Stack-nesemu

        You might also be interested to check out the DIY controller shown on this review video recently posted on twitter by "Live Sparks": https://youtu.be/ThuaCke6c34

        1 Reply Last reply Reply Quote 0
        • K
          Kryten
          last edited by

          The pipe is %7C url encoded. So adding

          s.replace("%7C", "|");

          at the end will let you use your pipe in the password.

          I will look in to the nes emulator.

          JJJ 2 Replies Last reply Reply Quote 0
          • JJJ
            JJ @Kryten
            last edited by

            @kryten
            Thanks - I had actually used that technique and from what I can tell it seemed to work fine (no errors) - I just decided to simplify my password anyway...

            Next..... My SSID had a blank space in it.... I removed that. Still "timed out".

            1 Reply Last reply Reply Quote 0
            • JJJ
              JJ @Kryten
              last edited by

              @kryten
              This is working for me now.... using the original code.

              Removed space from SSID and earlier on had removed the pipe (|) in my password [although this could have been managed as suggested above]. Adjusted wifi router settings for WPA/WPA2 - Personal(Recommended) from "Automatic" to "WPA2-PSK" specifically. Connected to M5Stack via webpage , entered wifi settings... it retarts. Failed to connect to wifi. Restarted M5Stack again... no connection. Try again - this time connection is successful.

              Each time I restart M5Stack now it establishes a wifi connection very quickly.

              K 1 Reply Last reply Reply Quote 0
              • K
                Kryten @JJ
                last edited by

                @jimit

                I have tom many things connected to my WiFi to bother with canhing any router setup. And my esp8266's always connects. I figured it was best to fix this in code rather than doing workaround with WiFi.

                JJJ 1 Reply Last reply Reply Quote 0
                • I
                  ispybadguys
                  last edited by

                  I can't get this example to work. I modified the setup to:

                  [code]
                  void setup() {
                  m5.begin();
                  preferences.begin("wifi-config");

                  delay(10);
                  if (restoreConfig()) {
                  if (checkConnection()) {
                  settingMode = false;
                  startWebServer();
                  return;
                  } else {
                  settingMode = true;
                  setupMode();
                  }
                  }
                  }
                  [code]
                  I tried two SSID's, with and without spaces. There are no non-alpha or special characters in my password.

                  JJJ 1 Reply Last reply Reply Quote 0
                  • JJJ
                    JJ @Kryten
                    last edited by

                    @kryten
                    Fair enough... is a pain changing setups. Definitely better to change it in code where possible. But as you are no doubt aware, fixing the pipe in the password was straight forward, but fixing the issue of having a space in the SSID looks more involved..... If the ESP8266's will handle the space in the SSID, perhaps some of the code used on the ESP8266 can be transplanted to solve this ?

                    Or, as per the discussion in the following link, you could try using IDF... or try connecting to another access point just as a test. https://github.com/espressif/arduino-esp32/issues/836

                    Also, I could only successfully connect using the original code from the M5Stack Examples - not the modified code.

                    1 Reply Last reply Reply Quote 0
                    • JJJ
                      JJ @ispybadguys
                      last edited by

                      @ispybadguys

                      Have you tried the original code from the M5Stack Examples folder ? This modified example did not work for me.

                      As I just mentioned above, the original code worked for me once I had removed the space from my SSID.

                      It wont connect until you connect to the M5Stack webpage, enter your wifi details and allow it to restart... then it should connect. Try a few times if it doesn't work first time. Third time was the charm for me.

                      1 Reply Last reply Reply Quote 0
                      • K
                        Kryten
                        last edited by

                        @JimiT @ispybadguys

                        I wil lhave to try this once more. But my office has a space in the pwd. Would be really nice to have it work with space as well.

                        JJJ 1 Reply Last reply Reply Quote 0
                        • JJJ
                          JJ @Kryten
                          last edited by

                          @kryten

                          While not ideal, an alternative option may be to setup another wifi router on the network and set it up without the space in the SSID.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post