Hi,
I don't know if it is software or hardware problem, but I decided to post it here.
I'm reading values from 4-wire resistive touch screen. Everything works fine, values are correct. There is only one problem. When I put the touch screen close to my guitar pickup, there is the popping (clicking) noise every time ATmega168 reads value from the touch screen. The noise is received by my guitar pickup and then goes to my amp.
I'm reading the touch screen values in the main loop, so the program is reading the values all the time. Here is the code I use for reading (based on http://kalshagar.wikispaces.com/Arduino+and+a+Nintendo+DS+touch+screen ):
pinMode(xLow,OUTPUT);
pinMode(xHigh,OUTPUT);
digitalWrite(xLow,LOW);
digitalWrite(xHigh,HIGH); //clicking noise here
delay(27);
digitalWrite(yLow,LOW);
digitalWrite(yHigh,LOW);
pinMode(yLow,INPUT);
pinMode(yHigh,INPUT);
x = analogRead(yLow -14);
pinMode(yLow,OUTPUT);
pinMode(yHigh,OUTPUT);
digitalWrite(yLow,LOW);
digitalWrite(yHigh,HIGH); // clicking noise here
delay(27);
digitalWrite(xLow,LOW);
digitalWrite(xHigh,LOW);
pinMode(xLow,INPUT);
pinMode(xHigh,INPUT);
y = analogRead(xLow - 14);
I've commented two lines where clicking occurs. If I remove these two lines, there is no clicking noise (but there is also no reading from the touch screen). So I managed to figure out where exactly is the problem located. It's the digitalWrite(yHigh,HIGH) and digitalWrite(xHigh, HIGH);
I've tried to use different delays in various places but it didn't help. I can only delay the clicking noise, I cannot remove it. I've also tried digitalWriteFast library, but it didn't change anything. I connect the touch screen as the guy here: http://kalshagar.wikispaces.com/Arduino+and+a+Nintendo+DS+touch+screen
So there are 4 wires of touch screen connected to A0, A1, A2, A3, and each one of them also goes two GND through 10k resistors.
Any ideas how to solve the clicking problem? Software or hardware methods?
BA