Question: Please modify this code to include an option for switch to be press and then all lights will turn red, please much a walk interupt

Please modify this code to include an option for switch to be press and then all lights will turn red, please much a "walk" interupt option for the light system. --------------BSSR--------------- /* use delay loop, 1 sec on 1 sec off * default 16 MHz clock * LD2 connects to PA5 */ #include "stm32f4xx.h" void delayMs(int n); int main(void) { RCC->AHB1ENR |= 4; /* enable GPIOC clock */ //GPIOA->MODER &= ~0x00000C00; /* clear pin mode */ GPIOC->MODER = 0x00000555; /* set pin to output mode */ while(1) { GPIOC->BSRR = 0x001E0021; /* turn on LED */ //GPIOA-> ODR = 0x20; //GPIOC->ODR = 0x21; delayMs(2000); GPIOC->BSRR = 0x00010002; //GPIOC->ODR = 0x22; delayMs(1000); GPIOC->BSRR = 0x0022000C; //GPIOC-> ODR = 0x0C; delayMs(2000); GPIOC->BSRR = 0x00080010; //GPIOC-> ODR = 0x14; delayMs(1000); } } /* 16 MHz SYSCLK */ void delayMs(int n) { int i; for (; n > 0; n--) for (i = 0; i < 799; i++) ; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!