Pages: [1]   Go Down
Author Topic: strange behavior of a qprox  (Read 246 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

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;

    }
  }
}



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


thanks for any reply
nicolas
Logged

Pages: [1]   Go Up
Jump to: