Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started