Switching 5V current between two solenoids

The easiest thing is two output pins and two N-channel MOSFETs.

And, there's no need to read anything. Just write high & low...

Write high to the 1st relay and low to the 2nd relay.
delay
Write low to the 1st relay and high to the 2nd.
delay
loop

There are other ways to do it (there always are) but that seems like the most straightforward way.