I have a problem related to the external power supply (DC). I have an Arduino Uno and I power it via usb 5v, I also have another 5v power supply (Pwr A), I plug Pwr A(+) into pin 8 (digital), Pwr A (-) on pin GND and it gives me a value of 1 when Pwr A is on but when I turn off PwrA it gives me a random value between 0 and 1, I use (Analog Voltage Meter) to check the power its voltage, it gives me values between 0.1V- 0.5V, so Digital pins can work with voltage around 0.1V-0.5 V? what resistor to use so that it always returns 0 when I turn off Pwr A?
Also, is there any way to know the exact voltage value supplied to pin 7 (digital).
When you turn off or remove power going to the pin, you leave a "floating pin", so any noise can be picked up by the pin. You need to make that pin either stay connected or connect it to ground or stop measuring voltage on a pin that is not connected to anythng.
Use a pull-down resistor between pin 8 and ground. A 10k resistor should work just fine. It will pull the pin to ground when there isn't 5v coming in. When there is 5v, the supply is powerful enough to provide a 5v signal with only a small amount "leaking" to ground through the resistor. Like this, only they used pin 2 for input instead of pin 8: