What is wrong with this MSP430 code?
There are no pullups on P2.6 and P2.7.



The MSP has internal pullup / pulldowns but you have to set them up yourself.

So as part of your initialization, add this

P2REN |= (1&lt;&lt;6) | (1&lt;&lt;7);  // turn on pullups
P2OUT |= (1&lt;&lt;6) | (1&lt;&lt;7);  // set them to pull up


Then the inputs won't float randomly when the switches aren't pressed.