Getting digital and analogue data into and out from an Texas Instruments MSP432 LaunchPad Evaluation Kit.
Introduction to Code Composer Studio.
#include "msp.h" void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1DIR |= BIT0; // make bit 0 an output (for the red LED) P1DIR &= ~BIT1; // ensure bit 1 is an input (for Button 1) P1REN |= BIT1; // enable resistor on P1.1 P1OUT |= BIT1; // make the resistor pull up. while(1) { if (P1IN & BIT1) // if the button is NOT pressed { P1OUT |= BIT0; // turn LED on } else { // button IS pressed P1OUT &= ~BIT0; // turn LED off } } }