Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • LED Lights

LED Lights

Review and Practice

Self-Check

In this activity, you learned how to use the digital_write() method to blink two lights in various arrangements to each other.

  • Were you able to blink the two lights together? Alternately?
  • Were you also able to get the two lights to blink in a sequence?
  • Thinking back over the last several activities. Do you understand the difference between how to work with write_analog and write_digital?

Questions

  1. When using the write_digital() method, how do you change the length of time the light stays on?
  2. In what order do the statements execute?
     

Exercises

  1. Change the blink rate in the following statement to 1/10 th of a second: sleep(500).
  2. What two “write” methods can be used to turn LEDs on and off?.
  3. Which “write” method turns the LED on for part of a period, adjusting the brightness level?
  4. Which loop keeps the statements repeating indefinitely?
  5. How can you easily change the script from two lights blinking simultaneously to blinking alternately?
  6. In which situation(s) are pin().write_digital() statements for blinking LEDs paired ahead of a sleep() statement: alternating, sequential, or simultaneous?
     

Project

Create a script that holds the green LED on while the yellow LED turns on and off. Place the code for the green LED outside the while True() loop.


Printer-friendly version
Sequential Blinks
Prev
Solutions
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress