MSP430F5529 LunchPad(1)
#include <msp430.h>
void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
P1DIR |= 0x01; // configure P1.0 as output
P4DIR |= 0x80; // configure P4.7 as output
P2DIR &= ~(0x01 << 1);
P2OUT = 0x02;
P2REN |= 0x01 << 1;
while(1)
{
if(P2IN & 0x02) // P2.1
{
P1OUT &= 0xFE; // P1.0
P4OUT |= 0x80; // P4.7
}
else
{
P1OUT |= 0x01; //
P4OUT &= 0x7F; //
}
}
}