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/MSP430FR2311: Unable to do digitalRead() able to do digitalWrite() Energia CCS

Part Number: MSP430FR2311
Other Parts Discussed in Thread: ENERGIA

Tool/software: Code Composer Studio

A slide switch is connected to port P2_3 (7) and led to P2_0 (19)

int LED = 19;
int sw=7;
int onx=1;

//see pins_energia.h for more LED definitions
//#define LED GREEN_LED
  
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(LED, OUTPUT);
  pinMode(sw, INPUT);
  //digitalWrite(sw,HIGH);
}

// the loop routine runs over and over again forever:
void loop() {
  onx = digitalRead(sw);
  digitalWrite(LED,HIGH);
  delay(1000);
  digitalWrite(LED,onx);
  delay(1000);
 }

Unable to read any values from sw pin. But the digitalWrite() works just fine.

**Attention** This is a public forum