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:
    • played with scripts and the write_analog() method to control the brightness of an LED assigned to a specific pin and
    • used loops with these scripts.
  • Were you able to calculate the appropriate values for write_analog() to get the desired brightness?
  • Were you able to use for/n in range() to adjust how the LED performed?  

Questions

  1. What frequency does the write_analog() method set for the light blink?
  2. A change in the high time for each light blink will appear to the eye as a change in what?
  3. What is the range for how long the light stays on using the write_analog() method?
  4. What values are needed in  a for…in range() loop to make it count values down?

Exercises

  1. To reduce the brightness of the light by ⅛, you need to change the argument of pin14.write_analog(1023) to what value?
  2. Calculate the necessary value for the write_analog()argument for 50% brightness.
  3. Calculate the necessary value for the write_analog() argument for 3/4th  brightness.
  4. Insert the necessary values in the following loop to make it count down by a step of 2 from 100 through 2. for n in range ( ).
  5. Write a for…in range() statement that will gradually increase the brightness of the LED to half its maximum value.

Project

  • Some sleep alarms increase in brightness to gently wake you and then try again if it doesn’t work. Alter the speed of the change and pauses in brightness to create this effect.

 


Printer-friendly version
More About A/D
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