🤖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?

    Core 2
    2
    3
    1.2k
    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
      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
        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
          czm88 @teastain
          last edited by

          @teastain Thanks, that worked like a charm!

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