Closed brianteeman closed 1 year ago
Sorry, the documentation on the official website has not yet been updated, please try using the following code.
#include <M5Core2.h>
Button lt(0, 0, 160, 120, "left-top");
Button lb(0, 120, 160, 120, "left-bottom");
Button rt(160, 0, 160, 120, "right-top");
Button rb(160, 120, 160, 120, "right-bottom");
void colorButtons(Event& e) {
Button& b = *e.button;
M5.Lcd.fillRect(b.x, b.y, b.w, b.h, b.isPressed() ? WHITE : BLACK);
}
void dblTapped(Event& e) {
Serial.println("--- TOP RIGHT BUTTON WAS DOUBLETAPPED ---");
}
void setup() {
M5.begin();
M5.Buttons.addHandler(colorButtons, E_TOUCH + E_RELEASE);
rt.addHandler(dblTapped, E_DBLTAP);
}
void loop() {
M5.update();
}
Describe the bug
Following the documented API at https://docs.m5stack.com/en/api/core2/touch
The example code for TouchEvent structures completely fails to compile
To reproduce
Create a new sketch with just the example code from the documentation
Expected behavior
Compiles without error
Screenshots
Environment
Windows11 Arduino IDE 2.0.3 M5Core2 v0.1.5 library
Additional context
A previous user reported this #90 but it was closed without a real answer
Issue checklist