Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1temp = 23.7 | Adac.write(sound_level) | |
| 2button_pressed = 1 | BA switch is a digital input, so it can only be 0 or 1. A value like 0.63 suggests a smooth analogue range. | |
| 3An analogue sensor's smooth signal must be converted to a digital number before the microprocessor can use it | CAn analogue-style reading: a temperature can take any value in a smooth range, not just fixed steps | |
| 4A digital output can be turned into a smooth analogue signal for a speaker using a DAC | DAn analogue light sensor gives a range of values, not just 1 or 0. Showing only on/off treats it as a digital signal. | |
| 5switch_state = 0.63 | EA digital signal: it has only two fixed values, 1 (on) or 0 (off) | |
| 6light_level = 1 # analogue sensor | Fvalue = adc.read() |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
analogue vs digital — Analogue signals vary smoothly over a range; digital signals have fixed values like on/off (1/0). Systems convert between them, e.g. ADC at a sensor input, DAC at a speaker output.state = read_digital(switch)
if state == 1:
light_on()level = read_analogue(temp_sensor)
print(level)adc = ADC(Pin(34))
value = adc.read()speaker = DAC(Pin(25))
speaker.write(volume)pressed = switch.value()
if pressed == 1:
light.on()