MrDEB !!!! Before Jon pops a gasket..
I don't have another gasket to pop, but I appreciate the concern
I am just mystified that the order of doing things is such a difficult concept to grasp.
SETALLDIGITAL sets all pins to digital*.
If you set up a pin for analog input (i.e., as an ADC input), shouldn't it be obvious that following that with SETALLDIGITAL undoes everything you just did? That's why I attempted to get MrDEB to think about what actually is going on**, but I know that's never going to happen.
*notwithstanding tumbleweed's detailed explanation.
**what is actually happening, not some blurry, hand-waving idea.