Hi,
As long as you only need to read digital "input", you can leave the pin configured as analog.
I believe TTL logic high (when using a 5 volt supply) is 2V.
So, just read your analog input and if the voltage is higher than 2V, set a logic flag high. If it's less than 2V, set the flag low.
That being said, you could just reconfigure the pin as Melanie suggested.
However, it sounds like you want to leave it configured as analog for some reason.
I'd be curious to see if you could simply read the pin's input value (not the ADC value) when it's configured as analog. It would be interesting if it registered as a 1 when the voltage was greater than 2V. You should try it.
Cheers!
Bookmarks