Questions
- Answer: 50 Hz
- Answer: Brightness
- Answer: 0 - 1024
- Answer: A start, stop, and (negative) step value.
Exercises
- Answer: change pin14.write_analog(1023) to pin14.write_analog(128)
- Answer: 1024 x 0.5 = 512
- Answer. 1024 x 0.75 = 768
- Answer: for n in range(100, 1, -2)
- Answer: for brightness in range(512) Note: the variable name is up to the student.
Project
Solution:
from microbit import* while True: for brightness in range(0,1023,10): sleep(500) pin14.write_analog(brightness) sleep(1000)