#include <Arduino.h>
#include <M5Core2.h>
void checkLCDTask(void* pvparams){
TickType_t lastTick;
while(1){
M5.update();
if(M5.Touch.ispressed()){
TouchPoint_t currentTouch = M5.Touch.getPressPoint();
Serial.printf("%d %d\n", currentTouch.x, currentTouch.y);
}
vTaskDelayUntil(&lastTick, 20/portTICK_PERIOD_MS);
}
}
void setup() {
// put your setup code here, to run once:
M5.begin(true, false, true);
xTaskCreate(checkLCDTask, "CheckTouch", 2048, NULL, 2, NULL);
}
void loop() {
// put your main code here, to run repeatedly:
}
This code prints only -1 -1 whenever a finger is put on the screen, if I move the M5.update() line to the loop function it will print the correct coordinates for a few seconds then return to only printing -1 -1.
I'd hope that either location for M5.update() would work correctly but I can't figure out why it isn't working.
This code prints only
-1 -1
whenever a finger is put on the screen, if I move the M5.update() line to the loop function it will print the correct coordinates for a few seconds then return to only printing-1 -1
.I'd hope that either location for M5.update() would work correctly but I can't figure out why it isn't working.