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

    M5Dial and Canvas in Lcd module

    Micropython
    micropython
    2
    5
    2.1k
    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.
    • M
      Microbug
      last edited by

      Hello,

      I'm trying to use the Canvas in Micropython and can't get things working.

      from M5 import Lcd
      toto=Lcd.newCanvas(60,50)
      print(toto.width(),toto.height())
      toto.fillCircle(x=10,y=10,r=5,color=0xffffff) # centre
      toto.push(0,0)

      This does not display anything :/

      I see that newCanvas can accept up to 4 arguments but can't find their signification.

      Any help ?

      Thansk !

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

        Hello @Microbug

        it looks like the circle is in the invisible upper left corner of the round display. Moving it helps. Try this:

          from M5 import Lcd
          Lcd.clear() # added
          toto=Lcd.newCanvas(60,50)
          print(toto.width(),toto.height())
          toto.fillCircle(x=50,y=40,r=5,color=0xffffff) # modified
          toto.push(0,0)
        

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • M
          Microbug
          last edited by

          omg , I feel so stupid !

          Many thanks !

          Any idea for the 2 more parameters on newCanvas ?

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

            Hello @Microbug

            it looks like bits per pixel (bbp) and whether device has PSRAM or not. See here and here.

            Thanks
            Felix

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

            M 1 Reply Last reply Reply Quote 0
            • M
              Microbug @felmue
              last edited by

              @felmue many thanks !

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