I have an ATTiny84 whose pins are connected to a photoresistor and resistor (480 ohm) as pictured above. However, really the intention of the photoresistor aspect is to mimic the circuit pictured below, where the green represents the sensor pin which is read using DigitalRead. When I power the circuit in such a configuration that only the sensor pin is tied to the MCU, then it works exactly as intended. If, leaving the circuit powered, I connect the wire that goes to ground on the below circuit to one that is tied (by writing the below code in the setup method) to ground, then it works.
pinMode (5, OUTPUT);
The same is true if I just switch the other pin (which is tied to HIGH), or even both at the same time. But, if I turn off then re-power the circuit in the exact same configuration, then it does not work as intended. The different between the pin set to HIGH and the one set to LOW and 5 and 0 v, respectively, is at most ~1v in both cases. Is there a fix that will ensure it works on booting? Why is this happening?