#include #define LED1 BIT0 #define LED2 BIT6 #define S2 BIT3 #define DEL1 5000 void delaytime(unsigned int timex) { while (timex != 0) { timex--; } } void main(void) { WDTCTL = WDTPW + WDTHOLD; P1DIR |= (LED1 + LED2); P1OUT &= ~(LED1 + LED2); for (;;) { while ((P1IN & S2) == S2) { P1OUT ^= LED1; delaytime(DEL1); } P1OUT &= ~(LED1); while ((P1IN & S2) != S2) { P1OUT ^= LED2; delaytime(DEL1); } P1OUT &= ~(LED2); } }