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

    Core2 and sprites - don't play well together?

    Scheduled Pinned Locked Moved Core 2
    3 Posts 2 Posters 2.6k 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.
    • C Offline
      czm88
      last edited by czm88

      Can anyone tell me if the have sprites working correctly on their Core2 and if so, did you need to do something special to make them work. I don't think there is anything wrong with my code (see below) but the numbers don't overwrite them selves neatly a create quite a mess.
      0_1710787988263_IMG_0041-sharpened copy.jpg

      Code:
      #include <M5Core2.h>
      #include "Bunken20pt7b.h"

      #define color1 0x2144

      TFT_eSprite spr = TFT_eSprite(&M5.Lcd);

      int backlight = 2800;

      void setup() {

      M5.begin();
      M5.Axp.SetLcdVoltage(backlight);
      spr.createSprite(320,240);
      spr.fillSprite(color1);
      

      }

      void loop() {

      M5.update();
      backlight = backlight + 1; if (backlight >= 3300) backlight = 0;
      //M5.Axp.SetLcdVoltage(backlight);
      spr.setTextDatum(4);
      spr.setFreeFont(&Bunken20pt7b);
      spr.setTextColor(TFT_ORANGE,color1);  
      spr.drawString(String(backlight),160,120);
      spr.pushSprite(0,0);     
      delay(5);
      

      }

      teastainT 1 Reply Last reply Reply Quote 0
      • teastainT Offline
        teastain @czm88
        last edited by

        @czm88 I use a fill rectangle in the correct size and background colour to clear a text area before each write.
        Works a charm on my Core and Core2.

        Cheers, Terry!

        100% M5Stack addict with several drawers full of product!

        C 1 Reply Last reply Reply Quote 0
        • C Offline
          czm88 @teastain
          last edited by

          @teastain Thanks, that worked like a charm!

          1 Reply Last reply Reply Quote 1

          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