Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the arduino program that meets the following: Assume port A is connected t

ID: 642948 • Letter: W

Question

Write the arduino program that meets the following: Assume port A is connected to leds, port B is connected to switches. Your board will have an initial state will all LED on. If you press switch 1, LED 1 will be off, all other remain on. If you further press switch 1, it will go back to the initial state.

From initial state, If you press switch 1, then switch 2, led 1,2 will be off and the other leds remain on. If you further press switch 2, it will go back to initial state.

From initial state, if you press switch 1, 2, 3, then led 1,2,3 will be off and other remain on. If you further press switch 3, it will go back to initial.

Explanation / Answer

/*This program keeps LED on,when we press switch.LED become off when releases the key*/ #include main() { P1DIR=0x1; while(1){ if((P1IN&(1