みんな大好きM5Unifiedを使用。
API仕様書ないのまぁまぁきつくないっすか。
#include <M5Unified.h> void setup() { auto cfg = M5.config(); M5.begin(cfg); M5.Display.setTextSize(3); } void loop() { M5.update(); M5.Display.startWrite(); if (M5.Touch.isEnabled()) { auto t = M5.Touch.getDetail(); M5.Display.setCursor(0, 0); if (t.wasReleased()) { M5.Display.printf("x: %4d, y: %4d", t.x, t.y); } } M5.Display.endWrite(); delay(1); }
これに領域を指定してあげれば、特定の場所が押されたときになんか動作。というのもできるだろう。
参考
https://github.com/m5stack/M5Unified/blob/d7f880a293badd54958a6da2403855da4245aefc/src/utility/Touch_Class.hpp
https://lang-ship.com/blog/work/m5unified-1/#toc10