An mbed module is connected to two switches as shown in this schematic. These tw
ID: 644146 • Letter: A
Question
An mbed module is connected to two switches as shown in this schematic. These two switches will control the mbeds LED1.
a) Write the C++ declarations needed for the mbed class objects used.
b) Pull-up or pull-down resistors are needed to reliably detect a switch in the off/open state. Write the instructions needed to activate the appropriate resistors types for the two switches.
c) Write the instructions needed so that LED1 is on if, and only if, both switches are in the on/closed position.
An mbed module is connected to two switches as shown in this schematic. These two switches will control the mbed's LED1. a) Write the C++ declarations needed for the mbed class objects used. b) Pull - up or pull - down resistors are needed to reliably detect a switch in the off/open state. Write the instructions needed to activate the appropriate resistors types for the two switches. c) Write the instructions needed so that LED1 is on if, and only if, both switches are in the on/closed position.Explanation / Answer
a) Two of mbed's two switches will control the mbed’s LED1. They will be used to indicate the value of the output.
C++ declarations needed for the mbed class objects used are:
DOut led1(LED1);
DIn switch1(p15);
DIn switch2 (p16);
b) The instructions to activate the appropriate resistors types for the two switches are:
pin15.mode(PullUp);
pin16.mode(PullDown);
c) if(switch1==1 and swicth2==1)
led1=1;
else
led=0;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.