From 5253fdd58c88490e0f14fd7d308e02cb4c2b6a15 Mon Sep 17 00:00:00 2001 From: Julian Daube Date: Sun, 15 Dec 2019 02:46:34 +0100 Subject: [PATCH] add arduino test sketch for touchscreen reading --- .../arduino_touchscreen_test.ino | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/arduino_touchscreen_test/arduino_touchscreen_test.ino diff --git a/tests/arduino_touchscreen_test/arduino_touchscreen_test.ino b/tests/arduino_touchscreen_test/arduino_touchscreen_test.ino new file mode 100644 index 0000000..24ef00c --- /dev/null +++ b/tests/arduino_touchscreen_test/arduino_touchscreen_test.ino @@ -0,0 +1,38 @@ +void setup() { + // put your setup code here, to run once: + Serial.begin(9600); + Serial.println("\"setup\""); + +} + +class Panel { + int A,B; +public: + Panel(int one, int two) : A(one), B(two) { + pinMode(A, OUTPUT); + pinMode(B, OUTPUT); + } + + int Y() { + digitalWrite(A, 1); + int result = analogRead(B); + digitalWrite(A, 0); + return result; + } + + int X() { + digitalWrite(B, 1); + int result = analogRead(A); + digitalWrite(B, 0); + return result; + } + +} panel(A0,A1); + +void loop() { + // put your main code here, to run repeatedly: + Serial.print(panel.X()); + Serial.print("\t"); + Serial.println(panel.Y()); + delay(100); +}