SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
#85627
Hi,

i have connected a Nintendo DS TouchScreen to my Arduino duemilanove and i'm able to get only the x axis value, while the Y value is always 0 (zero).

Naturally i have read a lot of stuff on the web and tried a lot of scripts and connections (i'm not so good in electronic stuff so I often get inspiration from web) and it seems other people had the same problems (for example on this post: viewtopic.php?t=16873&highlight=touch+screen+nintendo)

Following the last source code I used :
Code: Select all

//modified to match my sparkfun connector
#define xLow  17
#define xHigh 15
#define yLow  16
#define yHigh 14
 
 
void setup(){
  Serial.begin(9600);
}
 
void loop(){
  pinMode(xLow,OUTPUT);
  pinMode(xHigh,OUTPUT);
  digitalWrite(xLow,LOW);
  digitalWrite(xHigh,HIGH);
 
  digitalWrite(yLow,LOW);
  digitalWrite(yHigh,LOW);
 
  pinMode(yLow,INPUT);
  pinMode(yHigh,INPUT);
  delay(10);
 
  //xLow has analog port -14 !!
  int x=analogRead(yLow -14);
 
  pinMode(yLow,OUTPUT);
  pinMode(yHigh,OUTPUT);
  digitalWrite(yLow,LOW);
  digitalWrite(yHigh,HIGH);
 
  digitalWrite(xLow,LOW);
  digitalWrite(xHigh,LOW);
 
  pinMode(xLow,INPUT);
  pinMode(xHigh,INPUT);
  delay(10);
 
  //xLow has analog port -14 !!
  int y=analogRead(xLow - 14);
 
    Serial.print(x,DEC);   
    Serial.print(",");     
    Serial.println(y,DEC); 
 
  delay(200);
}



Connections
I used four 10K Resistor connecting every pin to ground
A0 --> x1
A1 --> y2
A2 --> x2
A3 --> y1




Thanks in advance
Fabio