4-Wire Touch Screen Interface Step 3

Step 3: Programming the arduino

How it works ?

It works in 2 steps

  1. Measure X axis Voltage
To measure X axis voltage

a. We are going to measure voltage on Y1
   pinMode(Y1,INPUT);

 b. Make Y2 Tristate
   pinMode(Y2,INPUT); 
   digitalWrite(Y2,LOW);

c. Form a voltage divider in X1(+5V) and X2(GND)
   pinMode(X1,OUTPUT);
   digitalWrite(X1,HIGH);

   pinMode(X2,OUTPUT);
   digitalWrite(X2,LOW);

d. Read the ADC from Y1 pin
  X = (analogRead(Y1))/(1024/XYresolution);


  1. Similarly Measure Y axis Voltage
To measure Y axis voltage

a. We are going to measure voltage on X1
   pinMode(X1,INPUT);

 b. Make X2 Tristate
   pinMode(X2,INPUT); 
   digitalWrite(X2,LOW);

c. Form a voltage divider in Y1(+5V) and Y2(GND)
   pinMode(Y1,OUTPUT);
   digitalWrite(Y1,HIGH);

   pinMode(Y2,OUTPUT);
   digitalWrite(Y2,LOW);

d. Read the ADC from X1 pin

  Y = (analogRead(X1))/(1024/Yresolution); 


No comments:

Post a Comment