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.

CCS/MSP432P401R: Program to turn on the light with the button, and print to the CCS console

Part Number: MSP432P401R

Tool/software: Code Composer Studio

I took as a start the code from the Resource explorer. My current code turns on the blue light (and the light remains on for ever)

volatile uint32_t i;

    // Stop watchdog timer

    WDT_A_hold(WDT_A_BASE);

    GPIO_setAsOutputPin(

            GPIO_PORT_P2,

            GPIO_PIN2

            );

    while(1)

    {

   // I want to do something like : if switch  s1 is pressed, then execute this condition below. If not, then I call setOutputLowonPin method

  // Also I want to print to the console whether "lights is on" or "lights is off"

            GPIO_setOutputHighOnPin(

                                    GPIO_PORT_P2,

                                    GPIO_PIN2

                                    );

        // Delay

        for(i=1000000; i>0; i--);

    }

**Attention** This is a public forum