what happens if...

if the ldr was connected 5v ~~~~ 1k ~~~~ ldr ~~~ A1

does the voltage divider no longer work? A1 should act as gnd no?

A1 is not connected tho.
A0 might act as ground if you used
digitalWrite(D14, LOW);

Typically, an input pin (analog or digital) will NOT "act as ground"; inputs are almost an open-circuit.

digitalWrite(A1, LOW); //as suggested should do it though....

Turning the pins to low saves a lot of work using an extra pin :slight_smile: - ok cool thanks

Also would Guarantee the circuit operation... You would Know what state it was in... just by looking at the sketch.

Doc

Okay - I'll ask - why do you want to use A1 (or A0) as a ground?

kf2qd:
Okay - I'll ask - why do you want to use A1 (or A0) as a ground?

I can think of a few examples where one might want to use two output pins to drive a device. Say a two color led that activates one color or the other depending on direction of current flow, or simulate a third combined color be switching the two output pins at significant clocking speed. I've used a small 20ma single coil latching relay where I could select to set or reset the relay depending on current direction, or once set or reset I could place both outputs to the same state to allow for zero current consumption for the relay. There are other applications where it might be useful to 'power' a device via two output pins, it just has to have a maximum current draw less then the output pins are rated for.

Lefty