Jump to content
43oh

"led1" was not declared in this scope


Recommended Posts

So I'm getting an "X" not declared in this scope error. All I'm trying to do is blink the internal LEDs on my launchpad using external buttons. I know this subject has been brought up before but nothing in the other threads were helpful. I am running Energia 1.8.11E23 on windows 10 and I am using a MSP-EXP430F5529LP.

My code is as follows:

int button1 = P2_5;

Int button2 = P2_4;

Int button1State =0;

Int button2State=0;

void loop() {

pinMode(LED1,OUTPUT);

pinMode(LED2,OUTPUT);

pinMode (button1, INPUT);

pinMode (button2, INPUT);

}

void loop() {

button1State=digitalRead(button1);

button2State=digitalRead(button2);

if (button1State==HIGH)

{ digitalWrite(LED1,HIGH);}

else 

{digitalWrite (LED1,LOW);}

If(button2State==HIGH)

{digitalWrite (LED2,HIGH);}

else 

{digitalWrite (LED2,LOW);}

 

 

 

 

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...