add arduino test sketch for touchscreen reading

This commit is contained in:
Julian Daube 2019-12-15 02:46:34 +01:00
parent de9f3bf1b3
commit 5253fdd58c

View File

@ -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);
}