DPDT Switch Microcontroller
Figure 1. A very simple polarity reversal circuit using two GPIOs. GPIO tricks.

GPIO1 GPIO2  LED
----- -----  -----
  0     0    Off
  1     0    Green
  0     1    Red
  1     1    Off