Skip to content

How to use a button #140

@Grandpa-G

Description

@Grandpa-G

I am missing something. I am using the M5GFX button to create buttons. How do I know when it has been touched (CoreS2)? If I check isPressed, it is always false.

At the beginning, I have it defined

`#include <M5GFX.h>

M5GFX display;

LGFX_Button startBtn;
`

startBtn.initButton(&display, 150, 122, 150, 150, TFT_RED, TFT_GREEN, TFT_BLACK, "START", 4, 4); startBtn.drawButton();
This is in my setup.

In my loop
if (startBtn.justPressed()) { Serial.println("GET data"); collecting = true; } if (startBtn.isPressed()) { Serial.println("GET data pressed"); collecting = true; }

How do I get the start button to be recognized when it is touched?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions