Quote Originally Posted by flotulopex View Post
I have three 7seg-LEDs (three "digits") connected to a 16F88 @ 20MHz and I want them to act as buttons as well.
I'm wondering if the case of the 7 segment displays isn't killing your light input, ya know, the covering over the segments themselves...

I couldn't find exactly in your code how you compensated the effect of the surrouding luminosity
I just kept scanning the LEDs, keeping track of the highest and lowest result every returned. Just for arguments sake, let's say the highest result I've gotten is 500. The next time I scan, the highest result is 498, I might subtract 1 from my last known highest result. Same thing for the lowest result. I don't rely on absolute numbers. I keep track of the range of inputs, recheck the inputs, see if the same input is the highest more than once, then select the most probable out of the bunch.

My idea is to compensate the surrounding darkness by dropping the LED's Dot-Point voltage and hence, reduce the charging/discharging cycle.
I wonder if going the other direction, lighting it up a bit more would be better.
And it is a neat little thing to play with...
All in all, I think it's the 7 segment display itself that's going to cause you problems.