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

    Multiple errors when using <M5GFX.h> and MM5Stack.h> in same program

    Scheduled Pinned Locked Moved PRODUCTS
    1 Posts 1 Posters 2.6k Views 1 Watching
    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.
    • T Offline
      theMusicMan
      last edited by

      Hey all - sounds like a daft question but does anyone know if it is not possible to use both the M5Stack.h and M5GFX.h libraries in the same code please?

      I am simply starting to write code that plots a graph of temp from the ENVIII sensor. The factory code for this uses the M5Env and M5Stack libraries, and I want to also use the M5GFX library to plot data to the screen. However, when I add the M5Stack library to the code - and without changing anything else in the code at all - I get multiple errors upon compile. Now, I can post the code, but I have literally just started writing it and there's loads to do before I end up with the final version, so there's much not even penned as yet however it appears I have hit a hurdle at the very start.

      Simply adding #include <M5Stack.h> to this code created many many errors...

      #include <M5GFX.h>
      #include "M5_ENV.h"
      #include <M5Stack.h>

      M5GFX tft;
      SHT3X sht30;

      float tempC = 0.0;
      float tempF = 0.0;
      float hum = 0.0;

      void setup(void) {
      Wire.begin();
      M5.Power.begin();
      tft.init();
      tft.setTextDatum(textdatum_t::middle_center);
      tft.drawString("Temp Plot Test", tft.width() / 2, 20, 4);
      tft.drawLine(10, 10, 10, 100);
      }

      void loop(void) {
      tft.drawCircle(100, 100, sht30.cTemp, TFT_YELLOW);
      tft.println(sht30.cTemp);
      }

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post