Go Down

Topic: strange behavior of a qprox (Read 308 times) previous topic - next topic

nbuechi

hy,

i'm working with a qt110 chip.


so, when i try to read it just normal with the analog input tutorial, everything is fine. i check out the serial monitor, and i see the right values rollin. 1024 if no touch, 0 when i touch it.


but as i built it into my program, i never get a clear value. and the value, that it reads changes very oftly. here my reading function:

[font=Courier]void position(){
 int links;
 int rechts;
 links = analogRead(linkerPin);
 rechts = analogRead(rechterPin);
Serial.println(links);
 if(links < 500){
   if(positionValue < 64){
     int neuePos = positionValue << 1;
     positionValue = neuePos;
   }
 }

 if(rechts < 500){
   if(positionValue > 1){
     int neuePos = positionValue >> 1;
     positionValue = neuePos;[/font]
   }
 }
}



how can it be? is there something in general i have forgotten? any suggestions?


thanks for any reply
nicolas

Go Up