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

    M5Stack and Blynk

    PROJECTS
    2
    4
    13.5k
    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.
    • world101W
      world101
      last edited by world101

      I'm trying to get the M5Stack working with Blynk. I tried to compile a basic Blynk sketch and it's not working.


      #define BLYNK_PRINT Serial

      #include <M5Stack.h>
      #include <BlynkSimpleEsp32.h>

      // You should get Auth Token in the Blynk App.
      // Go to the Project Settings (nut icon).
      char auth[] = "my_auth_token";

      // Your WiFi credentials.
      char ssid[] = "my_ssid";
      char pass[] = "my_ssid_password";

      void setup()
      {
      // Debug console
      Serial.begin(9600);

      Blynk.begin(auth, ssid, pass);
      }

      void loop()
      {
      Blynk.run();
      }


      The Arduino errors are:

      Arduino: 1.8.5 (Mac OS X), Board: "M5Stack-Core-ESP32, QIO, 80MHz, 921600, None"

      In file included from /Users/world101/Documents/Arduino/libraries/Blynk/src/Blynk/BlynkApi.h:17:0,
      from /Users/world101/Documents/Arduino/libraries/Blynk/src/BlynkApiArduino.h:14,
      from /Users/world101/Documents/Arduino/libraries/Blynk/src/BlynkSimpleEsp32.h:20,
      from /Users/world101/Documents/Arduino/m5stack_blynk/m5stack_blynk.ino:38:
      /Users/world101/Documents/Arduino/libraries/Blynk/src/Blynk/BlynkTimer.h:38:36: error: conflicting declaration 'typedef void (* timer_callback)()'
      typedef void (*timer_callback)(void);
      ^
      In file included from /Users/world101/Documents/Arduino/libraries/M5Stack/src/M5Stack.h:94:0,
      from /Users/world101/Documents/Arduino/m5stack_blynk/m5stack_blynk.ino:37:
      /Users/world101/Documents/Arduino/libraries/M5Stack/src/utility/M5Timer.h:34:35: note: previous declaration as 'typedef class std::function<void()> timer_callback'
      typedef std::function<void(void)> timer_callback;
      ^
      Multiple libraries were found for "WiFi.h"
      Used: /Users/world101/Documents/Arduino/hardware/espressif/esp32/libraries/WiFi
      Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
      Multiple libraries were found for "SD.h"
      Used: /Users/world101/Documents/Arduino/hardware/espressif/esp32/libraries/SD
      Not used: /Users/world101/Documents/Arduino/libraries/SD
      Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
      exit status 1
      Error compiling for board M5Stack-Core-ESP32.

      This report would have more information with
      "Show verbose output during compilation"
      option enabled in File -> Preferences.


      If I comment out #include <M5Stack.h> it will compile fine, but I don't get to use any of the M5 functions like M5.Lcd.printf().

      Any ideas on how to fix it?

      I also tried the DH12 example from github and get similar errors.
      https://github.com/m5stack/M5Stack/tree/master/examples/Advanced/Blynk/Post-DHT12

      Thanks!

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

        @world101 @m5stack Hi World101,

        I got the same error trying to compile Blynk - PostDHT12 using the one in the list of M5Stack examples.

        But it looks like it worked back in September : https://twitter.com/M5Stack/status/907633635796193281

        Perhaps something got broken since then..... the blynk library was updated Dec 22nd....
        https://twitter.com/blynk_app

        Or another file update perhaps.......

        Anyone got it working ?

        1 Reply Last reply Reply Quote 0
        • world101W
          world101
          last edited by

          After further digging for the error, I found the following which has the solution.

          https://github.com/m5stack/M5Stack/issues/32

          I modified the header file Arduino/libraries/M5Stack/src/utility/M5Timer.h as follows.

          //typedef std::function<void(void)> timer_callback;
          typedef void (*timer_callback)(void);
          typedef void (*timer_callback_p)(void *);
          

          It now builds successfully and connects to the blynk cloud :-)

          @m5stack FYI... please add this to fix on the next release.

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

            @world101 Really glad you raised this question and found a solution... I have wanted to use it for quite a while but hadn't chased it.... thanks. Will test it out.

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