I'm trying to write some C++ code to run a relay control board. It should be simple but it's working the opposite of what I thought I was telling C++ to do. There's one switch connected to PINB1. If it's high I don't want anything to happen. If it's low (or closed) I want it to execute turn on the relays in the sequence that follows. The sequence works but it's turning on when the switch is high instead of low. And when I initially power up the relay sequence runs through once no matter what the switch is set to? I'm confused by this. Any advise would be greatly appreciated.