You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+13-5Lines changed: 13 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -21,25 +21,33 @@ To use this library, you must have a supported Arduino board and the Arduino Gig
21
21
```cpp
22
22
#include"Arduino_GigaDisplayTouch.h"
23
23
24
-
Arduino_GigaDisplayTouch touch;
24
+
Arduino_GigaDisplayTouch touchDetector;
25
25
26
26
voidsetup() {
27
-
touch.begin();
27
+
Serial.begin(115200);
28
+
touchDetector.begin();
28
29
}
29
30
30
31
voidloop() {
31
32
uint8_t contacts;
32
33
GDTpoint_t points[5];
33
34
34
-
if(touch.detect(contacts, points)) {
35
+
contacts = touchDetector.getTouchPoints(points);
36
+
if (contacts > 0) { //Check if at least one touch occurs on the screen
37
+
//Print the coordinates of all simultaneous contacts detected
38
+
for (uint8_t i = 0; i < contacts; i++) {
39
+
Serial.print(points[i].x);
40
+
Serial.print(" ");
41
+
Serial.println(points[i].y);
42
+
}
35
43
//Do something with the touch coordinates
36
44
}
37
45
}
38
46
```
39
47
## Examples
40
48
41
-
-**Touch_IRQ:** This example demonstrates how to detect touch event and retrieve coordinate values using the interrupt approach.
42
-
-**Touch_Polling:** This example demonstrates how to detect touch event and retrieve coordinate values using the polling/on-request approach.
49
+
-**[Touch_IRQ](../examples/Touch_IRQ):** This example demonstrates how to detect touch event and retrieve coordinate values using the interrupt approach.
50
+
-**[Touch_Polling](../examples/Touch_Polling):** This example demonstrates how to detect touch event and retrieve coordinate values using the polling/on-request approach.
0 commit comments