Question: This code let led work when I push the push botton and of when its not bushed. I want to use the same code and
This code let led work when I push the push botton and of when its not bushed.
I want to use the same code and when I push the button turn led on and stay on and when I push again it turns it of and I want it to repeat forever.
#include #define GREEN_LED 0x0080 #define CLEAR_GREEN_LED 0x007F #define BUTTON11 0x0004 #define DEVELOPMENT 0x5A80 #define ENABLE_PINS 0xFFFE main() { WDTCTL = DEVELOPMENT; PM5CTL0 = ENABLE_PINS; P9DIR = GREEN_LED; P1OUT = BUTTON11; P1REN = BUTTON11; while(1) { while((BUTTON11 & P1IN) == 0) { P9OUT = P9OUT | GREEN_LED; } P9OUT = P9OUT & CLEAR_GREEN_LED; } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
