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.