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

    M5Paper, using canvas in procedure

    Modules
    m5paper
    2
    2
    4.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.
    • P
      Powersoft
      last edited by

      Have wrote a simple program, with a procedure that use canvas.
      When compile the program get error message
      "canvas1' was not declared in this scope" .

      This is my program:

      #include <M5EPD.h>

      void setup() {
      M5.begin();
      M5.TP.SetRotation(180);
      M5.EPD.SetRotation(180);
      M5.EPD.Clear(true);
      canvas1.createCanvas(960, 540);
      canvas1.loadFont("/fonts/GenSenRounded-R.ttf", SD);
      DisplayDisplayWindSection(480, 270, 300, 3.5, 40)
      canvas1.pushCanvas(0, 0, UPDATE_MODE_GL16);

      }

      void loop() {
      // put your main code here, to run repeatedly:

      }

      void drawWindroos()
      {
      canvas1.loadFont("/fonts/GenSenRounded-R.ttf", SD);
      canvas1.createRender(30);
      canvas1.setTextSize(30);
      }

      The error is shown in the first line of the procedure drawWindroos.
      How to avoid this error?

      Cheers,
      Jan

      world101W 1 Reply Last reply Reply Quote 0
      • world101W
        world101 @Powersoft
        last edited by world101

        @powersoft
        Do you only have 1 canvas? Try canvas instead of canvas1.

        BTW, you can enclose your code in three back ticks (```) to make it easier for us to read, like this...

        this text has three back ticks before and after it
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post