Virtual pins to control bits?

Start with properly formatting your posted code, thanks.