int chkTouch(){ int a=0; // Capacitance change amount // Output High to outPin digitalWrite(outPin, HIGH); // Count until outPin goes HIGH when finger touches while (digitalRead(inPin)!=HIGH){ // count a++; } delay(1); //delay(2); // Output Low to outPin digitalWrite(outPin, LOW); //filter to smooth the values f+=(a-f)/2; //Serial plotter (Avoid automatic alignment of vertical axes) Serial.print(f); Serial.print(","); Serial.print(top); Serial.print(","); Serial.println(bottom); return (f); /* if(f>500){ analogWrite (vibPin, f); analogWrite (ledPin,f); }else{ analogWrite (vibPin, 0); analogWrite (ledPin, 0); } */ }