Skip to content

Instantly share code, notes, and snippets.

@hollyhockberry
Created September 28, 2021 10:07
Show Gist options
  • Save hollyhockberry/75b601251f42d0935a5002f5d6af45bb to your computer and use it in GitHub Desktop.
Save hollyhockberry/75b601251f42d0935a5002f5d6af45bb to your computer and use it in GitHub Desktop.
M5Paper: Detection of touched points.
#include <M5EPD.h>
void setup() {
M5.begin();
}
void loop() {
if (!M5.TP.avaliable()) {
return;
}
static int lastFingers = 0;
M5.TP.update();
if (!M5.TP.isFingerUp()) {
if (lastFingers != M5.TP.getFingerNum()) {
lastFingers = M5.TP.getFingerNum();
Serial.printf("Fingers: %d\r\n", M5.TP.getFingerNum());
}
} else {
if (lastFingers != 0) {
Serial.println("Fingers: 0");
lastFingers = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment