Is it possible to code a DPDT switch?

kydra1:
My goal is to run a couple sensors and charge some batteries with a solar panel during the day, and then at night switch to battery power. I've seen it is best to charge the batteries in parallel and to power the devices in series since I need the combined voltage to run the boards.

My advice would be to stop worrying about your DPDT switch idea, take a step back and re-think the design. It does not sound right to me. What concerns me is that the whole design could be very power inefficient. What type of battery are you using and why does your sensor circuit need such a high voltage? If the panel is charging the batteries is parallel, how can that be enough voltage to run the circuit as well? I think you are asking the wrong question. I think you should be asking how to power your circuit in the best way.

Please post a schematic and links to the components you are using, including the Arduino and sensors. The sticky post at the top of the forum section will show you how to post images and links.