This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Help with a beginners application - pushing button to blink led

Other Parts Discussed in Thread: MSP430G2553

Hi guys,

I am trying to do some simple stuff using only the launchpad.

I double checked and we got in the lab at my college the msp430 g2553. I looked up online and tried the code below, but it does not work on the microcontroller. It does some erractic behavior that I cant describe. I know there is a way using interrupt, but I am trying the simplest way.

Best regards,

#include <msp430g2553.h>

#define SAIDA 0x40
#define ACENDE_LED 0x40
#define APAGA_LED ~0x40
#define LE_BOTAO 0x08

void main( void )
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR = SAIDA;
P1OUT = 0x00;

while(1)
{
if(P1IN&LE_BOTAO)
{
P1OUT &= APAGA_LED;
}
else
{
P1OUT |= ACENDE_LED;
}
}
}

**Attention** This is a public forum