Looks like no one added any tags here yet for you.
Suppose a pushbutton switch connects pin 20 on the mbed to the mbed's Vout (power) pin. Pressing the switch completes the circuit between these two pins. What is this an example of?
An active-high switch
Suppose a pushbutton switch connects pin 20 on the mbed to the mbed's Vout (power) pin. Pressing the switch completes the circuit between these two pins. The resistor for pin 20 should be configured as:
A pull-down resistor
The "Blinky LED Hello World" template includes the following declaration to control built-in LED1:
DigitalOut myled(LED1);
For proper operation, the circuit for LED1 uses:
A current limiting resistor
The "Blinky LED Hello World" template uses the instruction
myled = 1;
to turn on LED1. We can conclude that LED1 is an example of:
An active-high LED
Unless otherwise specified, for the following problems assume a common-cathode 7-segment display is connected to the mbed, with segment A connected to p5, segment B connected to p6, and so on, up to segment G connected to p11. A variable for the 7-segment display has been declared:
BusOut display(p5,p6,p7,p8,p9,p10,p11);
Ignore the decimal point on the display.
What would be the state of the display after the following instruction?
display=0b0000110;
Segments B and C on, all others off
If a common-anode 7-segment display is used instead, what should the assignment in the previous problem be changed to so that the state of the display remains the same (the same segments are on or off)?
display=0b1111001;
To display the number 8 (by turning on all the segments) on the common-cathode display, what assignment should be used?
display=0b1111111;
What are the ramifications of changing the declaration to:
BusOut display(p11,p10,p9,p8,p7,p6,p5);
The program will run, but the symbols on the display will appear incorrectly unless the constants assigned are recomputed
Suppose there is the following declaration on our LPC1768 mbed:
AnalogOut aout(p18);
After the assignment:
aout = 0.5;
what would be the expected voltage on pin p18?
1.65 volts
After the assignment:
aout = 1.0;
what would be the expected voltage on pin p18?
3.3 volts
After the assignment:
aout = -1.0;
what would be the expected voltage on pin p18?
Ā
0 volts
The smallest change in voltage possible for the LPC1768 mbed's AnalogOut pin is approximately 3.2 mV. If a smaller change in voltage (more precision) is required, how should the digital-to-analog parameters be changed? (Note that these options may require hardware changes, possibly including using a different chip)
Increasing the number of bits in the conversion
After executing the instructions:
led.period(0.4);
led.pulsewidth(0.2);
What would be the duty cycle for the LED?
Ā
50%
After executing the instructions:
led.period(1);
led=0.1;
led.period(0.5);
What would be the duty cycle for the LED?
20%
While executing the following instructions:
while (1) {
led.period(0.4);
led.pulsewidth(0.2);
}
What is the frequency that the LED blinks at?
Ā
The LED is not blinking
Assume a piezo transducer is connected between pin 21 and ground and a PwmOut object controlling the pin 21 is configured for a period of 2 milliseconds.
Which of the following duty cycles would generate the loudest tone?
50%
Assume there is no noise and the power rail is exactly 3.3 volts.
Assume the following declarations:
AnalogIn ain(p20);
float x;
If pin p20 is connected to GND, what value would be stored in the variable x by the following instructions?
x = ain.read();
0
If pin p20 is connected to VOUT, what value would be stored in the variable x by the following instruction?
x = ain.read();
1
The LM35 temperature sensor outputs 10mV per degree Celsius (for example at 25 degrees, it would output 250 mV). Given that the LPC1768 mbed's analog-to-digital converter has 12 bits of precision, could it measure a change in temperature as small as 0.1 degrees if pin p20 is directly connected to the LM35's output?
True
Suppose after the following instruction, the variable x has the value 0x8000 (or 32768 in decimal). What is the approximate voltage on p20?
x = ain.read_u16();
1.65 V
For the switch connected to p18 to GND, how should the mbed
class object be declared?
a) DigitalOut redSw(p18);
b) p18 DigitalIn(redSw);
c) AnalogOut redSw(p18);
d) redSw DigitalOut(p18);
e) DigitalIn redSw(p18);
f) redSw AnalogOut(p18);
e) DigitalIn redSw(p18);
For the switch connected to p23, how should the mbed
class object be declared?
a) p23 DigitalIn(greenSw);
b) DigitalIn greenSw(p23);
c) PwmOut greenSw(p23);
d) greenSw DigitalOut(p23);
e) greenSw AnalogIn(p23);
f) DigitalOut greenSw(p23);
b) DigitalIn greenSw(p23);
For the green LED connected to p21, how should the mbed class object be declared?
a) p21 DigitalIn(greenLED);
b) AnalogOut greenLED(p21);
c) DigitalOut greenLED(p21);
d) greenLED DigitalOut(p21);
e) DigitalIn greenLED(p21);
f) greenLED AnalogIn(p21);
c) DigitalOut greenLED(p21);
For the red LED connected to p20, how should the mbed class object be declared?
a) p20 DigitalIn(redLED);
b) redLED DigitalOut(p20);
c) AnalogOut redLED(p20);
d) redLED AnalogIn(p20);
e) DigitalIn redLED(p20);
f) DigitalOut redLED(p20);
f) DigitalOut redLED(p20);
What instruction should be used so that the state of the switch connected to p18 can be reliably
detected (pull-up or pull-down resistor enabled/disabled as appropriate)?
a) redSw.read(0);
b) redSw.write(0);
c) redSw.mode(PullUp);
d) redSw.read(PullUp);
e) redSw.mode(PullDown);
f) redSw.read(PullDown);
c) redSw.mode(PullUp);
What instruction should be used so that the state of the switch connected to p23 can be reliably
detected (pull-up or pull-down resistor enabled/disabled as appropriate)?
a) greenSw.mode(PullDown);
b) greenSw.read(PullDown);
c) greenSw.read(0);
d) greenSw.write(0);
e) greenSw.mode(PullUp);
f) greenSw.read(PullUp);
a) greenSw.mode(PullDown);
Which of the following instructions will turn on the red LED connected to p20 if the switch
connected to p18 is currently pressed (closed) and turn off the LED if the switch is not current
pressed (open)?
a) if (redSw == 0) redLED = 1;
else redLED = 0;
b) if (redSw == 1) redLED = 1;
else redLED = 0;
c) if (redSw == 0) redLED = 0;
else redLED = 1;
d) if (redSw == 1) redLED = 0;
else redLED = 1;
e) redLED = redSw;
f) redSw = redLED;
a) if (redSw == 0) redLED = 1;
else redLED = 0;
Which of the following instructions will turn on the green LED connected to p21 if the switch
connected to p23 is currently pressed (closed) and turn off the LED if the switch is not current
pressed (open)?
a) if (greenSw == 1) greenLED = 1;
else greenLED = 0;
b) if (greenSw == 0) greenLED = 1;
else greenLED = 0;
c) if (greenSw == 1) greenLED = 0;
else greenLED = 1;
d) if (greenSw == 0) greenLED = 0;
else greenLED = 1;
e) greenLED = !greenSw;
f) greenSw = !greenLED;
a) if (greenSw == 1) greenLED = 1;
else greenLED = 0;
Suppose a photometric sensor outputs 0.005 V per lux and is connected to the mbed's analog to
digital subsystem. It is readable through an AnalogIn object named āphotometerā. Which of the
following instructions would compute the instantaneous (not average) light level (in lux):
a) lux = photometer.read();
b) lux = photometer.read()*0.005;
c) lux = photometer.read()/0.005;
d) lux = photometer.read()*3.3*0.005;
e) lux = photometer.read()*3.3/0.005;
f) lux = photometer.read()/3.3*0.005;
e) lux = photometer.read()*3.3/0.005;
int main()
return an integer value
DigitalOut
sending out to outside world from mbed, declares an object that can control the digital logic level of a pin
active high LED
cathode towards ground LED =1; turns on
active low LED
anode pin towards a positive rail LED =0; turns on
active high switch
positive power rail, needs a pull down resistor- input to ground sw=1 does something
active low switch
ground; needs a pull up resistor - input to power; sw=0 does something
digitalIn
declares an object that can report the digital logic level of a pin
BusOut
declares an object that can control the digital logic levels of a group of pins, with each bit controlling a pin
digital to analog
Va=(3.3)D/2^10
analog to digital
Va=(3.3)D/2^12
analogOut
declares an object that can control the voltage of a pin in very small steps on the range of 0 to 3.3v (p18)
PwmOut
declare an object that generates a pulsewidth modulated signal on a pin p21-p26
duty cycle
pulse width/period
serialpc(USBTX,USBRX)
pc.baud(9600)
AnalogIn
declares an object that can read the voltage of a pin in very small steps on the range of 0 to 3.3 p15-p20