Self-check
- In this activity, you:
- built an LED circuit and used a script to turn the LED off and on, adjusting the timing to create different patterns.
- calculated the period, frequency, and duty cycle.
- Did you successfully build your LED circuit?
- Can you adjust the rate at which the LED blinks and create different patterns?
- Do you understand period, frequency, and duty cycle and can you calculate each?
Questions
- What are LEDs used for in products, and what are examples where they are used?
- How is period defined?
- How is frequency defined?
- How is duty cycle defined?
- What ways are you able to modify the blink of a light?
Exercises
- How would you modify a light on/off loop to change it from blinking every ½ second to blinking every ¼ second?
- How do you vary the script so that the time the light is on is longer than the time off?
- What sleep values would make the light appear to constantly be on but still be blinking?
- What part of the write_digital() statement signals that the light will turn off?
- How can the for...in range() loop be used with a light?
- If the period length is 1 s and the LED is on for .25 s during the period, how long is the LED off?
- If the period is .75 s, what is the frequency?
- What is the duty cycle for an LED that stays on for 500 ms and off for 500 ms?
- If the duty cycle is 30% and the LED stays on for 300 ms, how long is the period?
Projects
- Try adjusting the Try This - Blink Timing script to mimic a typical counting crosswalk signal. What considerations are there?
- Some warning lights blink faster as they ‘run out of time,’ for example the classic movie bomb countdown timer. Write a script to mimic this.