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

    Core2 display remains black for a certain progamming flow

    Scheduled Pinned Locked Moved Arduino
    2 Posts 2 Posters 4.2k Views
    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.
    • H Offline
      HausBusDe
      last edited by

      I am facing a realy strange problem. If i leave the marked line (see NOT WORKING IF THIS LINE IS REMOVED) away then the display remains black. With this line its working. Since this line should not have a relevant effect on the general programm i wonder if this is a bug in the library or if i am doing something wrong. Any hint?

      #include <M5Core2.h>

      #define TFTW 320 // screen width
      #define TFTH 240 // screen height
      #define TFTW2 160 // half screen width
      #define TFTH2 120 // half screen height

      void setup()
      {
      M5.begin();
      Serial.begin(115200);
      showThermostat();
      }

      void showThermostat()
      {
      M5.Lcd.fillScreen(TFT_BLACK);
      M5.Lcd.setTextColor(TFT_GREEN);
      String text = "-28 ";
      M5.Lcd.setTextSize(8);

      int xpos = TFTW2-M5.Lcd.textWidth(text)/2;
      int ypos = TFTH2-M5.Lcd.fontHeight()/2;
      M5.Lcd.drawString(text, xpos, ypos, 1);
      M5.Lcd.drawCircle(210, ypos, 5, TFT_GREEN);
      M5.Lcd.drawCircle(210, ypos, 4, TFT_GREEN);
      M5.Lcd.drawCircle(210, ypos, 3, TFT_GREEN); // NOT WORKING IF THIS LINE IS REMOVED
      }

      void loop()
      {
      }

      1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue
        last edited by

        Hello @HausBusDe

        exactly why this is happening I cannot say, but it seems to be related to the double initialisation of Serial.begin() which is already happening through M5.begin(). As soon as I remove the Serial.begin() your code then works w/ or w/o the 'not working line'.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        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