Review and Practice

Self-check

  • In this activity you:
    • Added a third LED to your breadboard, and
    • Used lists to customize some LED on/off sequences.
  • Were you successfully able to create the third LED circuit?
  • Do you understand how to use microbit.pin objects in a list?
  • Can you accurately use the zip() function and modify the LED on/off sequences?

Questions

  1. What are two types of objects can you include in a list?
  2. Which function did you use to access two lists at the same time?
  3. Which statement accesses the pin to turn the LED on and off.

Exercises

  1. What type of information is in this list? location_list = [pin9, pin12, pin16]:
  2. What values turn the LEDs on and off?
  3. Describe what this line does: for time, temp in zip(time_list, temp_list):
  4. Create two short lists for names and scores then write a line of code that will match the name list with the score list.

Project

Create a script that turns the green on constantly for 10s, then flashes the yellow, and then finally ends with a solid red.
Solution.