I'm a beginner with AVRs and electronics in general, and can't figure out how to do the following with the ATtiny841:
I can check if a pin is pulled to ground or floating (momentary switch between pin and ground). For this I use digital input with the internal pull up enabled. The pin check senses the difference between being pulled to ground or floating (pressing the momentary switch).
Now I have a situation where I want to check weather there is power on a pin or not. Like a momentary switch connected between the pin and battery + instead of between the pin and ground. How can I do this? With the internal pull up enabled, this pin is always being signaled as high, connecting to power makes no difference. If I disable the internal pull-up (tri state) the pin check constantly alternates between high and low when floating. If I connect to + I get a stable high readings, and if I connect to ground I get a stable low readings, but when floating the result is constantly alternating between high and low.
I don't want to use the ADC for this, I'd like to use the pin check for high on connection to +, low on floating. How can I solve this?