Created
September 28, 2021 10:07
-
-
Save hollyhockberry/75b601251f42d0935a5002f5d6af45bb to your computer and use it in GitHub Desktop.
M5Paper: Detection of touched points.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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