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
  • Servo Position Control with Python and micro:bit

Servo Position Control with Python and micro:bit

Review and Practice

Self-check

  • In this activity, you:
    • Identified a servo’s major parts.
    • Connected battery power and a servo to your breadboard.
    • Wrote scripts to control which positions the servo held.
  • Were you able to properly tune the servo?
  • Were you able to use y = mx + b to calculate duty cycle and resulting angles?

                                   
Questions

  1. What are some ways that a hobby servo is likely different from a servo you would find used on larger equipment? Why?    
  2. What is fed to the servo through the connected cable?
  3. Given the setup of the servo, what are the smallest and largest angles through which the servo can rotate?
  4. Why does this servo horn not make a complete rotation?
     

Exercises

  1. Approximately what analog value will result in the servo horn pointing to 90°?
  2. Approximately what analog value will result in the servo horn pointing to 180°?
  3. What command is used to set the servo horn in motion to a specific location?
  4. When controlling the servo, what is the purpose of pin16.set_analog_period(20)?
  5. What’s the actual high time from pin16.write_analog(77)?

Projects

  1. Create a script that will move the horn back and forth between 0° and 15°.
  2. Modify the terminal control program so it restricts the range from 45° to 135°.
  3. Modify the terminal control program so that it informs the user of an error when they try to enter a value that’s out of the valid range.

Printer-friendly version
Equations for Setting Servo Angles
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